akhil batlawala akhil batlawala - 3 days ago 5
Android Question

Change edittext backgroundTint Color

Here is my editext, i want to change bottom line color of edittext. i use android:backgroundTint but its only work in API 21 and above it.

<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:backgroundTint="@color/edittintcolor"
android:drawableLeft="@drawable/lock"
android:hint=" Password"
android:padding="15dp"
android:textColor="@color/edittintcolor"
android:textColorHint="@color/edittintcolor"
android:textSize="18sp"
android:typeface="serif" />


I want to change this color using XML or style not in java code

Answer

bg.xml

 <shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <solid android:color="#FDEEF4" />
     <corners
          android:radius="15dp" />
    <stroke android:width="1dip" android:color="#F9966B" />



<EditText
    android:id="@+id/password"
    android:layout_width="200dp"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:background="@drawable/bd=g"
    android:hint="@string/password"
    android:inputType="textPassword" >

</EditText>
Comments