Ask*_*iip 2 xml android android-textinputlayout textinputlayout material-components-android
当我想在 EditText 中写我的提示与 OutlinedBox 重叠时,我的提示有问题,所以我不明白是什么问题。所以这是我的代码
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:errorEnabled="true"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/text_input_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:drawableStart="@drawable/ic_action_name"
android:hint="@string/Enter_Username"
android:inputType="textPersonName"/>
</com.google.android.material.textfield.TextInputLayout>
Run Code Online (Sandbox Code Playgroud)
我的问题:
删除android:layout_margin="10dp"你的TextInputEditText。
最好的解决办法应该是:
<com.google.android.material.textfield.TextInputLayout
app:startIconDrawable="@drawable/...."
android:hint="Enter_Username"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
...>
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/text_input_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName"/>
</com.google.android.material.textfield.TextInputLayout>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
426 次 |
| 最近记录: |