android - Numberpicker with String and breaklines -
numberpicker string , breaklines need! forum found using strings in numberpicker component. must make break lines better viewing possible? level of customization layout, style etc possible component?
private numberpicker np; np = (numberpicker) view .findviewbyid(r.id.np); np.setonclicklistener(this); np.setaddstatesfromchildren(false); getstringfornp();//populate np string array setnumberpickertextcolor(np, getactivity().getresources().getcolor(r.color.white)); private boolean setnumberpickertextcolor(numberpicker numberpicker, int color) { final int count = numberpicker.getchildcount(); for(int = 0; < count; i++){ view child = numberpicker.getchildat(i); if(child instanceof edittext){ try{ field selectorwheelpaintfield = numberpicker.getclass() .getdeclaredfield("mselectorwheelpaint"); selectorwheelpaintfield.setaccessible(true); ((paint)selectorwheelpaintfield.get(numberpicker)).setcolor(color); ((edittext)child).settextcolor(color); //*********************************** //attempts in vain //*********************************** // string replace = ((edittext)child).gettext().tostring().replace("\n"," "); // ((edittext)child).settext(replace); ((edittext)child).setsingleline(false); // ((edittext)child).sethorizontallyscrolling(false); ((edittext)child).setellipsize(textutils.truncateat.end); ((edittext)child).setmaxlines(2); // ((edittext)child).setinputtype(inputtype.type_text_flag_multi_line); tablerow.layoutparams params = new tablerow.layoutparams(layoutparams.match_parent,layoutparams.match_parent,1.0f); ((edittext)child).setinputtype(inputtype.type_class_text); ((edittext)child).setlayoutparams(params); numberpicker.invalidate(); return true; } catch(nosuchfieldexception e){ log.w("setnumberpickertextcolor", e); } catch(illegalaccessexception e){ log.w("setnumberpickertextcolor", e); } catch(illegalargumentexception e){ log.w("setnumberpickertextcolor", e); } } } return false; }
could me? need make line break, example of how being component text without breaks.
this lib lets use strings 1 line break.
Comments
Post a Comment