Change the color of edittext and selection in edittext

2

I'm using an AutoCompleteTextView and an EditText, for email and password, respectively. Is it possible to change their color? The following image is below: Change the selection color and the color on the screen:

XML:'

<android.support.design.widget.TextInputLayoutandroid:layout_width="match_parent"
            android:layout_height="wrap_content">

            <AutoCompleteTextView
                android:id="@+id/email"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:focusableInTouchMode="true"
                android:hint="@string/prompt_email"
                android:inputType="textEmailAddress"
                android:maxLines="1"
                android:singleLine="true"
                android:textColor="#D3D3D3"
                android:textSize="12dp"/>

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

        <android.support.design.widget.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <EditText
                android:id="@+id/password"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="10dp"
                android:hint="@string/prompt_password"
                android:imeActionId="@+id/login"
                android:imeActionLabel="@string/action_sign_in_short"
                android:imeOptions="actionUnspecified"
                android:inputType="textPassword"
                android:maxLines="1"
                android:singleLine="true"
                android:textColor="#D3D3D3"
                android:textSize="12dp"/>

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

' Thanks

    
asked by anonymous 08.06.2016 / 16:56

1 answer

4

Try this, add these styles to your style.xml :

<style name="StyledTilEditTextTheme">
    <item name="colorControlNormal">#e6ffffff</item> // Cor padrão da linha
    <item name="colorControlActivated">#faffffff</item> // Cor linha e texto quando recebe foco
</style>

<style name="StyledTilEditText">
    <item name="android:theme">@style/StyledTilEditTextTheme</item>
    <item name="android:paddingTop">4dp</item>
    <item name="android:textColorHint">#c8ffffff</item> // Cor texto(hint) sem foco
</style>

And in your TextInputLayout refer to the style you just created:

<android.support.design.widget.TextInputLayout 
   style="@style/StyledTilEditText"
   ... Seu width e blablabla>

   ... Seu EditText

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

Explaining (for those who did not understand):

<item name="colorControlNormal">#e6ffffff</item> // É a cor padrão da linha que fica embaixo do EditText

<item name="colorControlActivated">#faffffff</item> // Cor da linha e do texto hint(no seu caso email) quando receber foco(clique)

<item name="android:textColorHint">#c8ffffff</item> // É a cor normal do texto hint(email) 

The above example will look like this:

    
08.06.2016 / 17:18