TextInputLayout
2019-01-14 本文已影响2人
孤独的根号十二
<android.support.design.widget.TextInputLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
app:hintAnimationEnabled="true"
>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="请输入用户名" />
</android.support.design.widget.TextInputLayout>
app:hintAnimationEnabled="true" : 是否获得焦点的时候hint提示问题会动画地移动上去。
app:errorEnabled="true" 是都打开错误提示。
要使用错误提示还得自己定义规则。
app:counterTextAppearance="" 可以自己修改计数的文字样式。
app:counterOverflowTextAppearance="" 超出字数范围后显示的警告的文字样式