Tai Tran
Tai Tran

Reputation: 1406

Front View background transparent

I add a View in front of a textView. But I want I can see the text through my View. Like this: enter image description here

Thank in advance, any answers are appreciate :D

Upvotes: 1

Views: 935

Answers (2)

Ron
Ron

Reputation: 24233

In XML layout, make your background semitransparent. If it's a simple view add this to your main layout:

android:background="#80FFFFFF"

Upvotes: 3

Shankar Agarwal
Shankar Agarwal

Reputation: 34765

You can create a tranparent dialog by this.

public class DialogActivity extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        final AlertDialog alertDialog = new AlertDialog.Builder(this).create();
        alertDialog.setTitle(" ");
        alertDialog.setMessage("");
        alertDialog.setIcon(R.drawable.icon);
        alertDialog.setButton("Accept", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {                
            }
        });
        alertDialog.setButton2("Deny", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
            }
        });
        alertDialog.show();
    }
}

After this just put a line in AndroidManifest.xml, where you define your activity in manifest.

android:theme="@android:style/Theme.Translucent.NoTitleBar"

Try below code

Dialog mDialog = new Dialog(mContext, android.R.style.Theme_Translucent_NoTitleBar_Fullscreen);

Upvotes: 1

Related Questions