Changing tint color of Android EditText programmatically

后端 未结 5 666
孤城傲影
孤城傲影 2021-02-03 22:07

I am trying to change the tinting color of an EditText View programmatically during runtime. Basically i want to change what you would usually apply as ?attr/

5条回答
  •  遥遥无期
    2021-02-03 22:55

    This works for me:

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

    Source: Changing EditText bottom line color with appcompat v7

提交回复
热议问题