我在 textInputLayout 中使用 textInputEditText 我必须为我的editText设置背景以实现我的editText的边框视图。但是当我在 textInputLayout 上调用 setError() 时,整个 editText 颜色变为红色。但我只想更改错误文本的颜色,而不是整个视图。
设置错误前:
设置错误后:
这是我的 xml 代码:
<android.support.design.widget.TextInputLayout
android:layout_alignParentTop="true"
android:id="@+id/ex_pass_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:passwordToggleEnabled="false"
android:gravity="right">
<android.support.design.widget.TextInputEditText
android:id="@+id/ex_pass_et"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:hint="??? ???? ????"
android:inputType="textPassword"
android:textColor="#000"
android:textSize="15sp"
android:gravity="right|center"
android:background="@drawable/edittext_bg"
android:padding="8dp"
/>
</android.support.design.widget.TextInputLayout>
Run Code Online (Sandbox Code Playgroud)
请帮帮我,我做错了什么?
android android-layout android-edittext android-textinputlayout android-textinputedittext
android ×1