Search code examples
androidtextcolorsandroid-edittexthighlight

How to disable highlight when writing on EditText?


I'm trying to change the color or disable the highlight of the text when writing on my EditText.

  • How can I do that?
  • How can I set rounded borders to the highlight?

I want to do that becouse, when I start writing on my EditText the highlight overlap the rounded corners of my EditText, and it looks bad.

Code for background color and corner rounded of my EditText:

<?xml version="1.0" encoding="utf-8"?> 

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">    
<corners android:radius="5dp" />
<solid android:color="#FFFFFF"/> 

</shape>

Code of my edittext:

<EditText
        android:id="@+id/editTextUsuario"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/propertieseditextlogin"
        android:ems="10" >
<requestFocus />
</EditText>

There are 2 examples of my problem:


Solution

  • Solution of your second problem

    Give padding to your EditText

    Example:-

    <EditText
            android:id="@+id/editTextUsuario"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/propertieseditextlogin"
            android:paddingLeft="6dp"
            android:ems="10" >
    <requestFocus />
    </EditText>