Reputation: 430
Hi, I wish to achieve this look for my alert dialog but is unsure of how should i do it. I do know how to get the transparent alert dialog look in android but I can't find any clue for it to be translucent. Please leave some opinion or guide on how should I start doing it. Thanks so much!
Update: Sorry I have forgotten to include that actually I am using xml with the alert dialog theme instead of the normal alert dialog.
Upvotes: 3
Views: 2358
Reputation: 1570
add this line.
dialog.setBackgroundColor(Color.argb(0,0,0,0);
Upvotes: 0
Reputation: 124
you can creat custom dialog and refer it to style :
final Dialog dialog = new Dialog(context,R.style.cust_dialog);
then create xml in values folder named dialog_style.xml :
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="cust_dialog">
<item name="android:windowFrame">@null</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
<item name="android:windowBackground">@color/transparent_color</item>
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:textSize">30dp</item>
<item name="android:gravity">left</item>
</style>
</resources>
also create color.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="transparent_color">#00000000</color>
</resources>
by this you will get Translucent Dialog Box ,
and you can control the Translucency as you need.
hope help you.
Upvotes: 3
Reputation: 3163
To see the underlying activity un-dimmed:
dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
To have the Dialog's background translucent, you have to set a background color with alpha < 255 (see the Color
API).
Upvotes: 6