How can I change the bottom border color for TextField when focus?

Issue

I have a simple TextField :

enter image description here

How can I change the blue color (programmatically) to another color , when textfield is in focused ?

I’ve already accomplished partial solution :

  var v=this.page.getViewById< TextField>("a");
  var drawable = v.android.getBackground(); 
  drawable.setColorFilter(new Color("#b21755").android, android.graphics.PorterDuff.Mode.SRC_ATOP); 

But When I navigate to another control , the red color remains :

When It’s in focus :

enter image description here

when It’s out of focus : (red remains — I don’t want that , I want the default color )

enter image description here

How can I make the color to back to its default color when moving out of focus ?

Solution

on lose focus, call clearColorFilter() .

Answered By – dashman

Answer Checked By – Timothy Miller (AngularFixing Admin)

Leave a Reply

Your email address will not be published.