Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Underline under cursor

I have implemented Custom edittext, with custom style :

<android.support.design.widget.TextInputLayout

            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="Username"
            android:textColorHint="@color/white"
            app:hintAnimationEnabled="true"
            app:hintTextAppearance="@style/TExtAppearance"
            >

            <com.app.farmtrace.fieldagent.CustomView.EditText_SemiBold
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textColor="@color/colorAccent"
                android:theme="@style/EditTextStyle"
                android:id="@+id/username"
                android:maxLines="1"
                android:maxLength="50"
                android:inputType="textEmailAddress|textNoSuggestions"
                android:nextFocusDown="@+id/password"
                />

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

And this is the screen :

enter image description here

there is just the cursor and now when i again select the cursor i get this :

enter image description here

I dont want the yellow underline below the cursor.

This is tested in Moto g4 with android 7.0.

<style name="TExtAppearance">
    <item name="android:textColor">@color/white</item>
    <item name="android:textColorHighlight">@color/white</item>
    <item name="android:textColorHint">@color/white</item>
    <item name="android:textColorLink">@color/white</item>
    <item name="android:textSize">16sp</item>
    </style>



<style name="EditTextStyle" parent="Widget.AppCompat.EditText">
        <item name="colorControlNormal">@color/white</item>
        <item name="colorControlActivated">@color/colorAccent</item>
        <!--<item name="colorControlHighlight">@color/colorAccent</item>-->
    </style>

Edit Also Getting underline on error if i seterror and text not visible of error :

enter image description here

like image 739
Parth Anjaria Avatar asked Oct 26 '25 09:10

Parth Anjaria


1 Answers

I ran into the same issue. I was able to get rid of the cursor underline by removing the Widget.AppCompat.EditText parent style from my TextInputEditTexts' custom style. In other words, I changed my TextInputEditTexts' style from this:

<style name="MyEditTextStyle" parent="Widget.AppCompat.EditText">
        ...
</style>

to this:

<style name="MyEditTextStyle">
        ...
</style>

Example of one of my TextInputEditTexts referencing the style:

<android.support.design.widget.TextInputEditText
    android:id="@+id/edit_username"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/MyEditTextStyle"/>
like image 191
Ryan Avatar answered Oct 28 '25 23:10

Ryan