android how to remove edittext's HighlightColor

Viewed 35

I made a drag and drop function for my EditText view. The code I am using is the same as the Google official tutorial.

When I drop something into the EditText, it always shows a highlight on the EditText. I have tried setting drophelper.Options.Builder() setHighlightColor to transparent, but the highlight area just changed color.

Does anyone know how to disable the drop highlight?

Thanks for your help.

1 Answers

You can add a bit different color which is transparent whte

android:textColorHighlight="#00FFFFFF"

Or this

android:background="#00000000"

and disable default highlighting

android:defaultFocusHighlightEnabled="false"


<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TextView
        android:id="@+id/text_view_id"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:text="@string/hello"
        android:defaultFocusHighlightEnabled="false"
        android:textColorHighlight="#00FFFFFF" />
</LinearLayout>

Autofill Framework

The highlight could also bedue to Android's Autofill Framework more so if you could be using the android:autofillHints attribute. To override the highlight setting:

  • SDK min version must be > 26
  • In applications' theme (style) add android:autofilledHighlight and set the value to the color you want (to 'disable' this highlight just set it to transparent).
Related