Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android dialog transparent

Tags:

android

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.

enter image description here

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"/> 

like image 306
nasaa Avatar asked May 19 '11 13:05

nasaa


People also ask

How do I make ALert dialog background transparent?

setBackgroundColor(Color. TRANSPARENT); wv. setPadding(5, 25, 5, 0); ImageView imgcartl=(ImageView)layout.

Is there a color code for transparent?

You can actually apply a hex code color that is transparent. The hex code for transparent white (not that the color matters when it is fully transparent) is two zeros followed by white's hex code of FFFFFF or 00FFFFFF.


2 Answers

Try below code

Dialog mDialog = new Dialog(mContext, android.R.style.Theme_Translucent_NoTitleBar_Fullscreen); 
like image 53
ingsaurabh Avatar answered Sep 28 '22 10:09

ingsaurabh


try this:

mDialog.getWindow().setBackgroundDrawable(new ColorDrawable(0)); 
like image 24
Zsolt Safrany Avatar answered Sep 28 '22 10:09

Zsolt Safrany