android - Align NumberPicker Text to Left -
i using custom string in numberpicker. problem text comes in center, while want align left.
i tried extracting textview , setting gravity there, using following code -
textview nptextview = (textview) numberpicker.getchildat(1); nptextview.setgravity(gravity.left);
but sets gravity of selected text only. text in scrolling position, still comes @ center.
is there way align text left?
ps: using api level 15.
you can't sure 2nd child of numberpicker right textview because implementation of numberpicker in different apis different. try code instead.
(int = 0; < numberpicker.getchildcount(); i++) { view child = numberpicker.getchildat(i); if (child instanceof edittext) { ((edittext) child).setgravity(gravity.left); break; } }
Comments
Post a Comment