I am using android design library's TextinputLayout
. But couldn't customize the hint color, label color and the underline color of EditText
inside TextinputLayout
. Please help.
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
If you want to change the bar/line color and the hint text color of the
TextInputLayout
(what the accent color normally is), then just create this style:Then apply it to your
TextInputLayout
as a theme:This basically sets a theme (not style) to one view (as opposed to the whole activity).
apply this style to TextInputLayout
This Blog Post describes various styling aspects of
EditText
andAutoCompleteTextView
wrapped byTextInputLayout
.For
EditText
and AppCompat lib 22.1.0+ you can set theme attribute with some theme related settings:and apply them on
EditText
:For
AutoCompleteTextView
things are more complicated because wrapping it inTextInputLayout
and applying this theme breaks floating label behaviour. You need to fix this in code:and in
Activity.onCreate
:Based on Fedor Kazakov and others answers, I created a default config.
styles.xml
activity_layout.xml
Focused:
Without focus:
Error message:
Add this attribute in Edittext tag and enjoy:
You can override this style for layout
And also you can change inner EditText-item style too.