3

I have an AppCompatDialogFragment that creates a dialog with a single Edit text. I set the theme of the dialog as well as the Edit Text.

The issue I'm having is the cursor has a strange underline when selecting text. I need to remove this underline. The color of the underline and cursor is controlled by colorControlActivated.

This demonstrates the issue I'm having

The style being applied to the EditText is as follows:

 <!--Edit text for Logon dialog-->
  <style name="PrimaryLogonEditText" parent="Widget.AppCompat.EditText">
    <item name="android:textColor">@color/primary_color</item>
    <item name="android:singleLine">true</item>
    <item name="colorAccent">@color/primary_color</item>
    <item name="colorControlNormal">@color/primary_color</item>
    <item name="colorControlActivated">@color/primary_color</item>
    <item name="fontPath">fonts/AntartidaRounded-Medium.ttf</item>
  </style>

The Edit text layout is as follows:

<android.support.design.widget.TextInputLayout
            android:id="@+id/TxtInputL_LoginDialogPassword"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="16dp"
            android:layout_below="@+id/txtV_LoginDialogMessage"
            local:errorTextAppearance="@style/error_appearance"
            local:errorEnabled="true"
            style="@style/PrimaryColorAppCompatHint"
            local:hintTextAppearance="@style/PrimaryColorAppCompatHint">
            <EditText
                android:id="@+id/edtT_LoginDialogPassword"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="Password"
                android:text="ValidPassword@1"
                style="@style/PrimaryLogonEditText"
                android:theme="@style/PrimaryLogonEditText"
                local:hintTextAppearance="@style/PrimaryColorAppCompatHint" />
        </android.support.design.widget.TextInputLayout>
Marc Berman
  • 53
  • 1
  • 6

1 Answers1

0

As seen here, your EditText takes background from its parent Widget.AppCompat.EditText. So, just add this line to your style:

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

This will remove the selector cursor's underline.

Jules Dupont
  • 7,259
  • 7
  • 39
  • 39