Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: dialog box without shadow around it

How do I remove this "shadowBox" effect around the dialog box that fades the background?

I know I can create like totally custom view but let's say I want to keep it simple. I have xml layout for dialog with only textView and 2 buttons and I want to stop the fade only for this one dialog.

like image 328
yosh Avatar asked Jan 21 '11 10:01

yosh


People also ask

How do I turn off AlertDialog on android?

AlertDialog generally consists of the main title, the message, and two buttons, technically termed as a positive button and a negative button. Both positive and negative buttons can be programmed to perform various actions. By default, the negative button lets close the AlertDialog without any additional lines of code.

What's the difference between dialog and AlertDialog in android?

AlertDialog is a lightweight version of a Dialog. This is supposed to deal with INFORMATIVE matters only, That's the reason why complex interactions with the user are limited. Dialog on the other hand is able to do even more complex things .

How to display dialog box in android?

Alert Dialog code has three methods:setTitle() method for displaying the Alert Dialog box Title. setMessage() method for displaying the message. setIcon() method is used to set the icon on the Alert dialog box.

What is android elevation?

Elevation (Android) Elevation is the relative depth, or distance, between two surfaces along the z-axis. Specifications: Elevation is measured in the same units as the x and y axes, typically in density-independent pixels (dp).


1 Answers

Try:

dialog.getWindow().clearFlags(LayoutParams.FLAG_DIM_BEHIND);
like image 127
fal Avatar answered Oct 20 '22 01:10

fal