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
Post a Comment