gpt4 book ai didi

java - 使用material.textfield.TextInputLayout时,我的轮廓框覆盖了提示。如何在不覆盖盒子的情况下显示提示?

转载 作者:行者123 更新时间:2023-12-02 00:28:44 25 4
gpt4 key购买 nike

enter image description here

正如您在图片中看到的,我使用的是带有轮廓框样式的 Material textInputEditText。然而,我的提示“交换”被概述的框所覆盖。我怎样才能防止这种情况发生?

这是我的 textfield.TextInputLayout 代码:

<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/Exchange_Name"
app:errorEnabled="true"
android:paddingTop="32dp"
style="@style/TextInputLayoutStyle">

<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/Exchange"
android:inputType="text">

</com.google.android.material.textfield.TextInputEditText>

这是我的 styles.xml-

    <style name="TextInputLayoutStyle" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox">

<item name="boxStrokeWidth">2dp</item>
<item name="boxStrokeColor">#FF6F9824</item>

</style>

最佳答案

删除 TextInputLayout 中的 android:paddingTop="32dp"
此外,提示应设置在 TextInputLayout 上,而不是 TextInputEditText 上。

<com.google.android.material.textfield.TextInputLayout
android:hint="@string/Exchange"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/Exchange_Name"
app:errorEnabled="true"
style="@style/TextInputLayoutStyle"
>

enter image description here

关于java - 使用material.textfield.TextInputLayout时,我的轮廓框覆盖了提示。如何在不覆盖盒子的情况下显示提示?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58033527/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com