1

after setting a custom background drawable to my EditText now I'm trying to set an specific color for it's TextInputLayout error but when I set a color with textColor, it fills the EditText with that color too!

here is my background drawable file :

<?xml version="1.0" encoding="utf-8" ?>

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <corners android:radius="4dp" />
    <stroke
        android:width="1dp"
        android:color="@color/edit_text_border" />

</shape>

here is the way I defined EditTexts :

            <android.support.design.widget.TextInputLayout
            android:id="@+id/changePasswordOldTL"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginEnd="16dp"
            app:hintEnabled="false"
            android:layout_marginStart="16dp"
            app:errorTextAppearance="@style/error_appearance"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/changePasswordOldPasswordLabel">


            <EditText
                android:id="@+id/changePasswordOldET"
                style="@style/customEdiText"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:inputType="textPassword"
                android:maxLength="60" />

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

here is error_appearance and customeEditText style :

    <style name="error_appearance" parent="@android:style/TextAppearance">
    <!-- Hint color and label color in FALSE state -->
    <item name="android:textColor">@color/edit_text_border</item>
</style>

<style name="customEdiText">
    <item name="android:textSize">@dimen/edit_text_font_size</item>
    <item name="android:fontFamily">@font/sans_web_medium</item>
    <item name="android:textCursorDrawable">@null</item>
    <item name="android:textColor">@color/text_color</item>
    <item name="android:background">@drawable/edit_text_background</item>
    <item name="android:padding">@dimen/edit_text_padding_right_left</item>

</style>

here is the result :

enter image description here

but I don't want EditText being filled by textColor!

Dr.jacky
  • 3,341
  • 6
  • 53
  • 91
cup code
  • 49
  • 8

0 Answers0