@lovesosoi
2017-10-31T08:20:43.000000Z
字数 726
阅读 1088
传统的输入框是 EditText ,在 Material Design 中,增加了一种新样式的输入框 TextInputEditText,是继承与EditText,使用方法基本与 EditText 一致, 一般用的时候在外部嵌套一个TextInputLayout 。显示效果如图:
TextInputLayout属性
app:hintAnimationEnabled="true"
设置是否可以使用动画,默认是true
app:hintEnabled="true"
设置是否可以使用hint属性,默认是true
app:hintTextAppearance="@style/MyStyle"
设置hint的文本属性,改变hint文字的大小颜色等属性
app:counterEnabled="true"
设置是否可以开启计数器,默认是false
app:counterOverflowTextAppearance="@style/MyStyle2"
设置计算器越位后的文字颜色和大小
app:counterTextAppearance="@style/MyStyle"
设置正常情况下的计数器文字颜色和大小
app:counterMaxLength="11"
设置计算器的最大字数限制
app:errorEnabled="true"
是否允许错误提示
app:errorTextAppearance="@style/MyStyle2"
错误提示的文字大小和颜色
TextInputEditText 属性和 EditText 差不多就不介绍了