java - Text Color Not Changing in AlertDialogue -


i trying apply custom color in alertdialogue. changing text color background color in not changing singlechoiceitems text color. can see black color in page number below image.

enter image description here

i using style below code

<style name="alertdialogtheme" parent="theme.appcompat.light.dialog.alert">         <item name="colorprimary">@color/colorprimary</item>         <item name="android:textcolor">@color/textcolorlite</item>         <item name="android:background">@color/colorprimarydarklite</item>         <item name="colorprimarydark">@color/colorprimarydark</item>         <item name="coloraccent">?attr/mainaccentcolor</item>         <item name="android:buttonbarbuttonstyle">@style/dialogbuttonstyle</item>     </style>     <style name="dialogbuttonstyle" parent="@style/widget.appcompat.button.buttonbar.alertdialog">         <item name="android:textcolor">?attr/textcolor</item>         <item name="android:textstyle">bold</item>      </style> 

java code dialoge

alertdialog.builder builder = new alertdialog.builder(                     getactivity(), r.style.alertdialogtheme);             builder.settitle("go page:");             builder.setsinglechoiceitems(mpageoptions, mpageindx - 1,                     new dialoginterface.onclicklistener() {                         public void onclick(dialoginterface dialog,                                             int item) {                             moptiondiag.dismiss();                             mpageindx = item + 1;                             updatequoteslistserver();                             updatepageinfo();                         }                     });              builder.setnegativebutton("dismiss",                     new dialoginterface.onclicklistener() {                          public void onclick(dialoginterface dialog,                                             int id) {                          }                      });             moptiondiag = builder.create();             moptiondiag.show(); 

what should change black text color ?

thanks

in resources folder open styles.xml , add custom theme example this:

<style name="radiobuttonstyle" parent="material.drawable.radiobutton">     <!-- hint color , label color in false state -->     <item name="android:textcolorhint">@color/md_green_900</item>     <item name="android:textsize">20sp</item>     <!-- label color in true state , bar color false , true state -->     <item name="coloraccent">@color/md_green_400</item>     <item name="colorcontrolnormal">@color/md_green_900</item>     <item name="colorcontrolactivated">@color/md_green_400</item> </style> 

and in radiobutton in layout add theme of radiobutton this:

    <radiobutton         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:id="@+id/radioyes"         android:theme="@style/radiobuttonstyle"         android:text="yes"         android:textcolorlink="@color/md_light_green_900"         android:textcolorhighlight="@color/md_green_900"         android:textcolor="@color/md_light_green_900" /> 

ps: own custom radio button should work.


Comments

Popular posts from this blog

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -

python - Error while using APScheduler: 'NoneType' object has no attribute 'now' -