I understand how to set the dim amount for a Dialog. However, I would prefer that the color was a translucent white instead of a translucent black (or is it dark gray?). Any ideas?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
First, you need to create white 9-patch drawable. Similar to
panel_background.9.pngdrawable (which is black) that can be found at path:Let’s assume your drawable will be called
white_panel_background.9.png.Option 1.
You can create your custom theme that extends
Theme.Dialogand overrideswindowBackgroundattribute with custom white 9-patch drawable.And then use this theme in your dialog:
Option 2.
If you’ve already created the dialog (with default theme), you still can update its window background:
Note: you’ll need to change text colors from white to black (so its visible on white background).
Note: you’ll need to do some extra steps for AlertDialog as it uses its own styles for backgrounds. For more details see
AlertDialogstyle.