Yellow box appears around EditText once it has been Auto-Filled

Viewed 5164

As you will see by the screenshot below, it's clear to see that a yellow box appears around the EditText after it has been filled in. NOTE: This ONLY happens when the text that has been entered was AUTO-FILLED!!

Click for screenshot

My XML:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:baselineAligned="false"
    android:orientation="vertical">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <View
            android:id="@+id/view2"
            android:layout_width="match_parent"
            android:layout_height="@dimen/login_background"
            android:background="@color/colorPrimary" />

        <View
            android:id="@+id/view"
            android:layout_width="@dimen/login_container_width"
            android:layout_height="@dimen/login_container_height"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="@dimen/login_container_margin_top"
            android:background="@drawable/login_container"
            android:elevation="8dp">

        </View>

        <Button
            android:id="@+id/button"
            android:layout_width="250dp"
            android:layout_height="50dp"
            android:layout_alignParentBottom="true"
            android:layout_centerHorizontal="true"
            android:layout_marginBottom="55dp"
            android:background="@drawable/login_button"
            android:elevation="10dp"
            android:stateListAnimator="@null"
            android:text="LOGIN"
            android:textColor="@color/white"
            android:textSize="20sp" />

        <EditText
            android:id="@+id/editText"
            android:layout_width="300dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="25dp"
            android:elevation="10dp"
            android:ems="10"
            android:hint="Email address"
            android:inputType="textEmailAddress"
            android:textColor="@color/colorPrimary"
            android:layout_below="@+id/view2"
            android:layout_centerHorizontal="true"
            android:stateListAnimator="@null" />

        <EditText
            android:id="@+id/editText2"
            android:layout_width="300dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="23dp"
            android:ems="10"
            android:inputType="textPassword"
            android:elevation="10dp"
            android:hint="Password"
            android:textColor="@color/colorPrimary"
            android:layout_below="@+id/editText"
            android:layout_alignStart="@+id/editText"
            android:stateListAnimator="@null" />

    </RelativeLayout>

</LinearLayout>
1 Answers

You can customize that autofill's background. Create new styles file res/values-v26/styles.xml, add copy of your application's theme to that file with one additional line

<item name="android:autofilledHighlight">@android:color/transparent</item>

in this case it will be transparent, that is what I wanted to achieve, but you can use any color you like. https://developer.android.com/guide/topics/text/autofill

Related