[英]While using a material.textfield.TextInputLayout, my outlined box covers the hint. How can I display the hint without getting it covered my the box?
[英]While using TextInputLayout , how can the hint color be same while floating or while getting error ? Not same as the error color
XML
<com.google.android.material.textfield.TextInputLayout
style="@style/TextInputLayout"
android:id="@+id/abc_TIL"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<EditText
android:id="@+id/abc_TV"
style="@style/EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:digits="0123456789"
android:hint="abc*"
android:maxLength="11"
android:inputType="number"
android:maxLines="1"
android:textSize="@dimen/_12sdp" />
</com.google.android.material.textfield.TextInputLayout>
风格
<style name="EditText" parent="Widget.TextView">
<item name="android:textSize">@dimen/_13sdp</item>
<item name="android:textColor">@color/Black</item>
<item name="hintTextColor">@color/dark_grey</item>
<item name="colorControlNormal">@color/dark_grey</item>
<item name="colorControlActivated">@color/dark_grey</item>
<item name="colorControlHighlight">@color/dark_grey</item>
<item name="android:background">@drawable/background_grey</item>
</style>
<style name="TextInputLayout" parent="Widget.MaterialComponents.TextInputLayout.FilledBox">
<item name="android:layout_marginLeft">@dimen/_10sdp</item>
<item name="android:layout_marginRight">@dimen/_10sdp</item>
<item name="android:layout_marginTop">@dimen/_6sdp</item>
<item name="hintTextColor">@color/dark_grey</item>
<item name="android:textColorHint">@color/dark_grey</item>
<item name="colorControlNormal">@color/dark_grey</item>
<item name="colorControlActivated">@color/dark_grey</item>
<item name="colorControlHighlight">@color/dark_grey</item>
<item name="errorIconDrawable">@null</item>
**还尝试了 app:hintTextApperance 、 app:errorTextApperance 但没有得到我所期望的。 我希望在错误期间提示颜色和错误颜色不同。发生错误时提示颜色不应为红色,应为灰色,错误文本应为红色 **
编辑:在对象上设置提示,该对象位于您的 TextInputLayout(EditText、TextView 等)内,以保存提示和错误的不同颜色。
访问链接。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.