InputTextLayout

TextInputLayout

萝らか妹 提交于 2019-12-06 18:48:38
TextInputLayout TextInputLayout 是一个布局,仅可以添加一个子View且必须为ExitText。 TextInputLayout 为用户提供了两个比较有意思的方法 1.hint是EditText的一个很好的属性,当用户输入数据后,hint内容将自动消失。使用TextInputLayout用户输入数据后内容将不会直接隐藏,而是上浮继续显示; 2.用户输入信息错误,错误提示将直接显示在输入EditText下发。 示例代码: 布局代码: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <EditText android:id="@+id/original_edittext" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/section_label" android:hint="请输入密码" /> <android.support.design.widget