android - Reducing font size of AlertDialog.Builder's components -
i created alertdialogue
using next code :
int selectedmodeid=0; public void sorttypemodeselection(){ alertdialog.builder alertbuilder=new alertdialog.builder(watchlistdetailactivity.this); alertbuilder.setsinglechoiceitems(r.array.watchlist_sorting_modes,selectedmodeid, new dialoginterface.onclicklistener(){ public void onclick(dialoginterface dialog, int which) { switch (which){ case 0: selectedmodeid=0; break; case 1: selectedmodeid=1; break; case 2: selectedmodeid=2; break; case 3: selectedmodeid=3; break; case 4: selectedmodeid=4; break; case 5: selectedmodeid=5; break; case 6: selectedmodeid=6; break; case 7: selectedmodeid=7; break; } dialog.cancel(); } }); alertbuilder.show(); }
i made alert, want cut down font size of list items of dialog. how can this?
note: don't recommend inflating custom layout accomplish this, wish know if there approach.
i able accomplish through styles. added style styles.xml
file in values directory:
<style name="alertdialogtheme" parent="android:theme.dialog"> <item name="android:textsize">14sp</item> </style>
then when creating alertdialog
, wrapped activity context in contextthemewrapper
, passed builder
constructor:
contextthemewrapper cw = new contextthemewrapper( this, r.style.alertdialogtheme ); alertdialog.builder b = new alertdialog.builder( cw );
this produced smaller text size list items in dialog.
android android-alertdialog android-custom-view android-fonts
No comments:
Post a Comment