gpt4 book ai didi

Android - 如何删除 setError() 的感叹号

转载 作者:行者123 更新时间:2023-12-02 20:58:21 28 4
gpt4 key购买 nike

我的 xml 代码的密码字段部分:

<android.support.percent.PercentRelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
...

<android.support.design.widget.TextInputLayout
android:layout_below="@+id/uname_ly"
android:id="@+id/text_input_layout_passwd"
app:layout_widthPercent="70%"
android:layout_centerHorizontal="true"
app:layout_heightPercent="10%"
app:layout_marginTopPercent="0%"
app:layout_marginBottomPercent="0%"
android:adjustViewBounds="true"
android:textColorHint="@color/editTextHintColor"
app:hintTextAppearance="@style/TextAppearance.App.TextInputLayout"
>

<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/nopasswd"
android:inputType="textPassword"
android:maxLines="1"
android:textColor="@color/editTextTextColor" />

</android.support.design.widget.TextInputLayout>
...

调用 setError() 时如何删除这个覆盖的红色感叹号? enter image description here

[更新样式]

<style name="TextAppearance.App.TextInputLayout" parent="@android:style/TextAppearance">
<item name="android:textColor">@color/editTextHintColor</item>
</style>

最佳答案

使用setError(CharSequence error, Drawable icon)方法。将drawable设置为null:

editText.setError("Pls provide email", null);

关于Android - 如何删除 setError() 的感叹号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40153682/

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