1

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"/>
Manjunath
  • 2,063
  • 2
  • 29
  • 60

2 Answers2

7

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.

Ahmad
  • 69,608
  • 17
  • 111
  • 137
1

create similar design by your own. you can use the resources of api 16. you can find those at /android-sdks/platforms/android-16/data/res/ folder

stinepike
  • 54,068
  • 14
  • 92
  • 112