How to make TextInputLayout NOT fill the background when error gets set?

Viewed 1416

I am getting the following. When the error is set, I don't want the box to be filled in red. I am new to using TextInputLayout. How do I fix this?

enter image description here

I have the following

    <android.support.design.widget.TextInputLayout
        android:id="@+id/til_confirm_password"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="@dimen/textBoxBottomGap"
        android:layout_marginLeft="@dimen/leftRightMargin"
        android:layout_marginRight="@dimen/leftRightMargin"
        app:hintEnabled="false">

        <EditText
            android:id="@+id/confirm_password"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/rounded_edittext"
            android:hint="Confirm Password"
            android:inputType="textPassword"
            android:maxLines="1"
            android:paddingBottom="5dp"
            android:paddingLeft="@dimen/padding"
            android:paddingRight="@dimen/padding"
            android:paddingTop="5dp"
            android:ems="10"
            android:textColor="#999999"
            />

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

@drawable/rounded_edittext is referencing the following.

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" android:padding="15dp">
    <solid android:color="#FFFFFF"/>
    <corners
        android:bottomRightRadius="3dp"
        android:bottomLeftRadius="3dp"
        android:topLeftRadius="3dp"
        android:topRightRadius="3dp"/>
    <stroke android:width="1dip" android:color="#999999" />
</shape>

I have the following in Activity:

    if (!newPlainPssd.equals(confirmPlainPssd)) {
        etConfirmPassword.requestFocus(); //references editText
        tilConfirmPassword.setError("Passwords don't match"); //references TextInputLayout
        return;
    }
1 Answers

Try this

    if (!newPlainPssd.equals(confirmPlainPssd)) {
            etConfirmPassword.requestFocus(); //references editText
            tilConfirmPassword.setError("Passwords don't match"); //references TextInputLayout
             text.setError("Nilesh");
                editText.setBackgroundColor(Color.TRANSPARENT);

                new Handler().postDelayed(new Runnable() {
                    @Override
                    public void run() {

                        editText.setBackgroundResource(R.drawable.rounded_edittext);
                    }
                }, 50);
            return;
        }
Related