简体   繁体   中英

Android Material recolor EditText underline

how can I recolor the underline of an EditText in android 5.0 (Material) ? It is appearing gray but I want it to be blue, how can I archieve that?

you have to set in your app Theme this line:

    <item name="android:colorControlActivated">#123490</item>

(or colorAccent for wider range of coloring)

more about new Material xml styles params HERE . you should also define colorPrimary and colorPrimaryDark

以编程方式执行: editText.getBackground().setColorFilter(getResources().getColor(android.R.color.white), PorterDuff.Mode.SRC_ATOP);

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