android - AlertDialog not applying custom theme -


i increase textsize of alert dialog message text, added following styles:

<?xml version="1.0" encoding="utf-8"?> <resources>     <style name="apptheme" parent="@android:style/theme.holo.light.darkactionbar">         <item name="android:actionbarstyle">@style/mainactionbar</item>          <item name="android:textappearance">@android:style/textappearance</item>         <item name="android:textappearancelarge">@android:style/textappearance.large</item>          <item name="android:alertdialogstyle">@style/alertdialog</item>     </style>      <style name="textappearance" parent="@android:style/textappearance">         <item name="android:textsize">24sp</item>      </style>      <style name="textappearance.large">         <item name="android:textsize">28sp</item>     </style>      <style name="alertdialog" parent="@android:style/theme.holo.light.dialog">         <item name="android:textappearancemedium">@style/textappearance.large</item>     </style> </resources> 

however style not applied when displaying dialog.

what missing?

theme

 <style name="appcompatalertdialogstyle" parent="theme.appcompat.light.dialog.alert">             <item name="android:background">@android:color/white</item>             <item name="android:textcolor">#000000</item>         </style> 

alertdialog

    private void prompt() {         alertdialog.builder alert = new alertdialog.builder(new contextthemewrapper(                 getactivity(), r.style.appcompatalertdialogstyle));         alert.settitle("update ssid");         alert.setmessage(html.fromhtml("<font color='#009688'>do want update heater ssid </font><font color='red'><u>" + constants.wifi_ssid.touppercase() + "</u></font><font color='#009688'> ?</font>"));         linearlayout layout = new linearlayout(getactivity());         layout.setorientation(linearlayout.vertical);         final textview secure = new textview(getactivity());         secure.settypeface(util.setcustomfont(getactivity()));         final edittext titlebox = new edittext(getactivity());         titlebox.settypeface(util.setcustomfont(getactivity()));         secure.settext(html.fromhtml("<font color='#009688'><br><b>enter new ssid</b></font>"));             /*edittext setting*/         titlebox.setgravity(view.text_alignment_gravity);         linearlayout.layoutparams params = new linearlayout.layoutparams(linearlayout.layoutparams.match_parent, linearlayout.layoutparams.wrap_content);         params.setmargins(35, 5, 35, 10);         titlebox.setlayoutparams(params);         titlebox.setsingleline(true);         titlebox.setbackgroundresource(r.drawable.edit_text);         titlebox.settextcolor(color.parsecolor("#505050"));         titlebox.setinputtype(inputtype.type_text_flag_cap_characters);         // titlebox.settext("****************");         titlebox.settextsize(12);        /*textview setting*/         linearlayout.layoutparams paramss = new linearlayout.layoutparams(linearlayout.layoutparams.wrap_content, linearlayout.layoutparams.wrap_content);         paramss.setmargins(35, 10, 35, 5);         secure.setlayoutparams(paramss);         layout.addview(secure);         layout.addview(titlebox);         alert.setview(layout);         alert.setpositivebutton("cancel", new dialoginterface.onclicklistener() {             public void onclick(dialoginterface dialog, int whichbutton) {             }         }).setnegativebutton("update", new dialoginterface.onclicklistener() {             public void onclick(dialoginterface dialog, int whichbutton) {             }         });         final alertdialog alertdialog = alert.create();         alertdialog.show();         alertdialog.getbutton(dialoginterface.button_negative).setenabled(false);         titlebox.addtextchangedlistener(new textwatcher() {             @override             public void beforetextchanged(charsequence charsequence, int i, int i1, int i2) {             }              @override             public void ontextchanged(charsequence charsequence, int i, int i1, int i2) {                 int ssidlength = charsequence.length();                 if (ssidlength == 0) {                     return;                 }                 if (!character.isletterordigit(charsequence.charat(ssidlength - 1))) {                     titlebox.gettext().delete(ssidlength - 1, ssidlength);                     return;                 }                 if (ssidlength < 2) {                     alertdialog.getbutton(dialoginterface.button_negative).setenabled(false);                 } else {                     alertdialog.getbutton(dialoginterface.button_negative).setenabled(true);                 }                 if (ssidlength > 12) {                     titlebox.gettext().delete(ssidlength - 1, ssidlength);                 }             }              @override             public void aftertextchanged(editable editable) {              }         });      } 

edit_text.xml

<?xml version="1.0" encoding="utf-8" ?>  <shape xmlns:android="http://schemas.android.com/apk/res/android"     android:shape="rectangle"     android:thickness="0dp">     <stroke         android:width="0.5dp"         android:color="#009688" />      <gradient         android:angle="270"         android:endcolor="#ffffff"         android:startcolor="#ffffff"         android:type="linear" /> </shape> 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -