简体   繁体   中英

What style attribute do I use to change the color of an EditText's focused bottom line?

I'm trying to change the color of the bottom line from the focused EditText in my style.

When I start editing text the color of the bottom line changes to a teal in the appcompat.Light them. I'm wondering what attribute this color comes from.

Also I'm supporting back to API 14 so I can't use the tint colors.

You can change this color in xml with this line:

android:backgroundTint="@color/blue"

You can change it in code with something like:

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

You can also change this everywhere in your app by adding this line to you style in your themes.xml file:

<item name="colorControlActivated">@color/blue</item>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM