How to consistently set EditText Selected Underline Color Programmatically

前端 未结 5 2070
情深已故
情深已故 2021-02-20 09:05

I\'m trying to build a renderer for Xamarin Forms. The renderer needs to set the EditText underline color to \"Active Color\" when selected and \"Hint Color\" when

5条回答
  •  走了就别回头了
    2021-02-20 10:01

    You need to set the backgroundTintList or supportBackgroundTintList on the EditText to an instance of ColorStateList

    ColorStateList colorStateList = ColorStateList.valueOf(color)
    editText.setSupportBackgroundTintList(colorStateList)
    

    OR

    I think that if you want to change a bottom line color, then you can change using this below line

    editText.getBackground().mutate().setColorFilter(getResources().getColor(R.color.your_color), PorterDuff.Mode.SRC_ATOP);
    

    And Application theame like this:-

    
    

    Please check this Example

    Hope this Link1 Link2 helps you.

提交回复
热议问题