Académique Documents
Professionnel Documents
Culture Documents
This is the ColorStateList that is default for the EditText background. This file points to various background resources in each state. So, from inspection, it appears that we need to create NinePatch art for the following drawable files: textfield_default.9.png, textfield_disabled.9.png, textfield_pressed.9.png, textfield_selected.9.png, textfield_disabled_selected.9.png, etc So, this is where and how Androids default EditText gets the Orange look!
From my theme.xml
<resources> <style name="mytheme" parent="@android:style/Theme" > <item name="android:editTextStyle">@style/red_edittext</item> </style> </resources>
From my styles.xml
<resources> <style name="red_edittext" parent="@android:style/Widget.EditText"> <item name="android:focusable">true</item> <item name="android:focusableInTouchMode">true</item> <item name="android:clickable">true</item> <item name="android:background">@drawable/red_edit_text</item> <item name="android:textColor">@color/state_list</item> <item name="android:gravity">center_vertical</item> <item name="android:textColorHint">@color/default_text_color</item> <item name="android:textColorHighlight">@color/transparent_red</item> </style> <style name="droiddate_btn" parent="@android:style/Widget.Button"> <item name="android:background">@drawable/btn_default_red</item>
</style> </resources>
Results:
So now all EditText boxes should have my new red color instead of the default Orange. Although this might not be your end goal, just to change an EditText box from orange to red, it allows you to see how Android NinePatch, ColorStateList , Styles, and Themes can all work together to override and skin any control in Android. It could obviously be much more dramatic than my example below. Good luck, here is the result: