I want to get rid of the border in my dialog box and make it look absolutly transparent, as if the image is on the top of screen.
My dialog xml is –
<?xml version="1.0" encoding="utf-8"?>
<ImageView android:id="@+id/ImageView01"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_centerHorizontal="true" android:visibility="invisible"/>
Try below code
Dialog mDialog = new Dialog(mContext, android.R.style.Theme_Translucent_NoTitleBar_Fullscreen);
Answer:
try this:
mDialog.getWindow().setBackgroundDrawable(new ColorDrawable(0));
Answer:
To give a translucent effect, say 50% opacity, use:
Drawable d = new ColorDrawable(Color.BLACK);
d.setAlpha(130);
mDialog.getWindow().setBackgroundDrawable(d);
‘130’ can be changed (0-255) to acheive desired opacity.
Answer:
try this:-
final Dialog dialog = new Dialog(this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
dialog.setContentView(R.layout.splash);
dialog.show();
Answer:
For API 11+
Dialog mDialog = new Dialog(mContext, android.R.style.Theme_Holo_Light_Panel);
Answer:
The simplest way of doing this is that in your DialogFragment’s onCreate() method, call
setStyle(DialogFragment.STYLE_NO_FRAME, 0);
And if the view you returned in onCreateView does not have a background specified, the dialog’s background will be just transparent.
Why? DialogFragment.STYLE_NO_FRAME means that OS will not do any drawing in the window of the dialog, and your view is 100% responsible for drawing everything about the dialog.
Tags: androidandroid