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

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

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

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