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


#1

I have a simple TextField :

image

How can I change (programmatically) the blue color to another color , when focus ?

I’ve already managed to change the overall background color via :

 this.page
      .getViewById< TextField>("a")
      .android
      .setBackgroundColor(new Color("#b21755")
      .android 

but it changes (obviously) all the background color. I want only the bottom border - when focus.


#2

Here you go


#3

Thanks for the response:)

…(not declarative)


#4

Partial solution :

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

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

When It’s in focus :

image

when It’s out of focus : (red remains)

image

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