TextInputLayout用于EditView输入框的,主要解决之前EditText在获得焦点编辑时hint属性提示语消失的问题,还可以对用户错误输入进行提示。
1.添加依赖包
compile 'com.android.support:design:22.2.0'
2.属性介绍
- hint 设置提示信息
- app:hintAnimationEnabled 设置是否可以使用动画,默认是true
- app:hintEnabled 设置是否可以使用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:errorTextAppearanc