How can I set the Style for an EditText with Holo theme which is in ICS to make it compatible for devices with API level 8.
I tried the following code, but it is not compatible with API 8.
<EditText
android:id="@+id/editText1"
style="@android:style/Widget.Holo.EditText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
You could use HoloEveryWhere.
Or you could do this:
<style name="MyTheme" parent="@android:style/Theme">
<item name="android:editTextBackground">@drawable/my_edittext</item>
</style>
my_edittext.xml:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_window_focused="false" android:state_enabled="true" android:drawable="@drawable/textfield_default_holo_light" />
<item android:state_window_focused="false" android:state_enabled="false" android:drawable="@drawable/textfield_disabled_holo_light" />
<item android:state_enabled="true" android:state_focused="true" android:drawable="@drawable/textfield_activated_holo_light" />
<item android:state_enabled="true" android:state_activated="true" android:drawable="@drawable/textfield_focused_holo_light" />
<item android:state_enabled="true" android:drawable="@drawable/textfield_default_holo_light" />
<item android:state_focused="true" android:drawable="@drawable/textfield_disabled_focused_holo_light" />
<item android:drawable="@drawable/textfield_disabled_holo_light" />
</selector>
You can find the mentioned drawables in your SDK folder.