I updated my phone to Android 6.0 and I have these 2 problems with dialogs:
1)The title is shown but the messages isn't for alert dialog(SOLVED):
new AlertDialog.Builder(context).setTitle("Title").setMessage("Message");
2)Also custom dialog fragment's title is not shown(NOT SOLVED):
getDialog().setTitle("Title");
There was not such a problem in lollipop or in older versions, the problem appeared only after updating my phone to marshmallow.
How to solve the problem?
Once check this hope this will work.......
Maybe your main text color is the same as dialog background color, in that case in your styles.xml use (just an example):
and in dialog creation:
Use constructor with theme for Lollipop and newer android versions:
Dark theme
And for Light theme
I've come across a few answers that say that you should use the following in your app theme:
While that is correct, it wasn't working in all places for me. Eventually, I realized that in some places I was using the regular AlertDialog builder and in other places I was using the support builder. If you are using the support AlertDialog, make sure to also include the following in your theme:
In my case all dialogs had the same color as fonts (title & message). What I have done to fix this state was the change of the color attribute in my theme. I copied the xml theme file into the 'res/values-v22' and set different color for marshmallow.
or only for dialogs
I suspect that you are ending up showing white text on a white background! (Looking at the screenshot, the (i) icon is not showing up well either, suggesting that it was designed to be shown on a background other than white.
You can use the constructor
public AlertDialog.Builder (Context context, int themeResId)
to ensure you are using a specific theme to style your dialog, where theTheme_Material_Dialog
is probably what you want.