Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom Support Dialog Fragment text is the wrong color

If I put a TextView in a custom dialog box, the text will be black by default.

Unfortunately, the support fragment dialogs backgrounds are dark gray. Black on gray is very hard to read.

I could change the TextView to white or something like android:textColor="?android:attr/textColorPrimaryInverseDisableOnly". But the dialog boxes on the new android (Holo Light) are white. So it will be white on white.

I could use a hack like forcing it to be white on old versions of Android and forcing it to be black on newer versions of Android, but I'd rather find a more elegant solution.

Is there a way to change the TextView to imitate the same text that's normally put on the support DialogFragment? I'm using Action Bar Sherlock, if that matters.

like image 869
Muz Avatar asked Oct 22 '22 16:10

Muz


1 Answers

Try this

alertDialogBuilder.setInverseBackgroundForced( true )

works fine in my case on pre-Honeycomb devices and newer ones. The title still appears in a darker color but the main text is clearly readable on all devices.

like image 76
HeyMan Avatar answered Oct 27 '22 09:10

HeyMan