How to change style of a default EditText
Solution 1:
Create xml file like edit_text_design.xml and save it to your drawable folder
i have given the Color codes According to my Choice, Please Change Color Codes As per your Choice !
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape>
<solid android:color="#c2c2c2" />
</shape>
</item>
<!-- main color -->
<item
android:bottom="1.5dp"
android:left="1.5dp"
android:right="1.5dp">
<shape>
<solid android:color="#000" />
</shape>
</item>
<!-- draw another block to cut-off the left and right bars -->
<item android:bottom="5.0dp">
<shape>
<solid android:color="#000" />
</shape>
</item>
</layer-list>
your Edit Text Should contain it as Background :
add android:background="@drawable/edit_text_design" to all of your EditText's
and your above EditText should now look like this:
<EditText
android:id="@+id/name_edit_text"
android:background="@drawable/edit_text_design"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/profile_image_view_layout"
android:layout_centerHorizontal="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="20dp"
android:ems="15"
android:hint="@string/name_field"
android:inputType="text" />
Solution 2:
You have a few options.
Use Android assets studios Android Holo colors generator to generate the resources, styles and themes you need to add to your app to get the holo look across all devices.
Use holo everywhere library.
Use the PNG for the holo text fields and set them as background images yourself. You can get the images from the Android assets studios holo color generator. You'll have to make a drawable and define the normal, selected and disabled states.
UPDATE 2016-01-07
This answer is now outdated. Android has tinting API and ability to theme on controls directly now. A good reference for how to style or theme any element is a site called materialdoc.
Solution 3:
I solved the same issue 10 minutes ago, so I will give you a short effective fix: Place this inside the application tag or your manifest:
android:theme="@android:style/Theme.Holo"
Also set the Theme of your XML layout to Holo, in the layout's graphical view.
Libraries will be useful if you need to change more complicated theme stuff, but this little fix will work, so you can move on with your app.
Solution 4:
I use the below code . Check if it helps .
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape android:shape="rectangle" >
<solid android:color="#00f" />
<padding android:bottom="2dp" />
</shape>
</item>
<item android:bottom="10dp">
<shape android:shape="rectangle" >
<solid android:color="#fff" />
<padding
android:left="2dp"
android:right="2dp" />
</shape>
</item>
<item>
<shape android:shape="rectangle" >
<solid android:color="#fff" />
</shape>
</item>
</layer-list>