android - Conditional XML edittext format -


is possible conditionally format widget using xml layout files?

for example: if value of edittext < 10, write in red, otherwise write green. here java code:

// code if (integer.parseint(edtxt.gettext().tostring()) < 10){     edtxt.settextcolor(color.red); }else{     edtxt.setcolor(color.green); } //or edtxt.settextcolor (integer.parseint (edtxt.gettext().tostring()) < 10 ? color.red:color.green); 

and put "this code" inside xml?

it can done if extend edittext custom view , there logic. can use attributes enter values comparison, , colors.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -