Set a consistent style to all EditText (for e.g.)

First, define the style for your EditText. Make sure that the parent style is android:Widget.EditText

<style name="CustomEditTextStyle" parent="android:Widget.EditText">

    <item name="android:textColor">#0F0F0F</item>
    <!-- ... More items here if needed ... -->
</style>

After that, override the attribute android:editTextStyle in your custom theme. Be aware, if you are using the support library, you will also need to override the attribute editTextStyle (without the android namespace).

<style name="App_Theme" parent="...">
   <item name="android:editTextStyle">@style/CustomEditTextStyle</item>
   <item name="editTextStyle">@style/CustomEditTextStyle</item> <!-- For compatibility with the support library -->
</style>

@Luksprog answer is correct but not working for me. After some experimentation, I found out that removing the android namespace from editTextStyle made it work for me.

<style name="App_Theme" parent="@android:style/Theme.Holo">
   <item name="editTextStyle">@style/App_EditTextStyle</item>
</style>

and make your custom style to extend Widget.EditText or if using the AppCompat theme Widget.AppCompat.EditText:

<style name="App_EditTextStyle" parent="@android:style/Widget.EditText">
    <item name="android:background">@drawable/filled_roundededges_box_dark</item>
    <item name="android:textColor">#808080</item>
    <item name="android:layout_height">45dip</item>
</style>

Override the attribute pointing to the EditText style(named editTextStyle :) ) in your custom theme:

<style name="App_Theme" parent="@android:style/Theme.Holo">
   <item name="android:editTextStyle">@style/App_EditTextStyle</item>
</style>

and make your custom style to extend Widget.EditText:

<style name="App_EditTextStyle" parent="@android:style/Widget.EditText">
    <item name="android:background">@drawable/filled_roundededges_box_dark</item>
    <item name="android:textColor">#808080</item>
    <item name="android:layout_height">45dip</item>
</style>

Edit:

If you're using the much newer AppCompat related themes use the editTextStyle attribute without the android prefix:

<style name="App_Theme" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="editTextStyle">@style/App_EditTextStyle</item>
</style>

Tags:

Android