android - How to reduce the font size in NumberPicker -
all, i'm customizing city picker, uses 3 numberpicker inside,like this:
its chinese province-city-area picker.
the code:
string[] areas = get_from_somewhere(); areapicker.setdisplayedvalues(areas);
i want cut down font size,any advice?
solution: refer this
you can extend default numberpicker
in custom class customnumberpicker
this:
public class customnumberpicker extends numberpicker { public numberpicker(context context, attributeset attrs) { super(context, attrs); } @override public void addview(view child) { super.addview(child); if(child instanceof edittext) { ((edittext) child).settextsize(25); } } }
now replace current numberpicker
in xml customnumberpicker
:
<com.pkg.name.customnumberpicker android:id="@+id/number_picker" android:layout_width="match_parent" android:layout_height="wrap_content" />
android numberpicker
No comments:
Post a Comment