BST*_*aal 6 android android-appcompat material-design android-textinputlayout
我正在使用TextInputLayout和AppCompatEditText,它具有基于自定义xml形状的背景,适用于AppCompatEditText.每当我设置一些错误时,错误行从布局的开始开始.有没有办法给该错误行填充.
小智 6
您可以使用以下方法引用错误TextView:
TextView textView = (TextView) inputLayout.findViewById(android.support.design.R.id
.textinput_error);
Run Code Online (Sandbox Code Playgroud)
然后,您可以使用其布局参数。
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:id="@+id/tx_in_username"
android:errorEnabled="true"
android:layout_marginLeft="@dimen/margin_LEFT_RIGHT"
android:layout_marginRight="@dimen/margin_LEFT_RIGHT"
android:layout_height="wrap_content">
<EditText
android:layout_width="match_parent"
android:layout_marginTop="10dp"
android:layout_height="36sp"
android:hint="Username"
/>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4165 次 |
| 最近记录: |