8

I just had a look at Ice Cream Sandwich source code, because I am trying to port the Holo Theme to all pre-4.0 devices.

I used a lot of usefull tools:

Action Bar: ActionBarSherlock

ICS Background:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
    android:angle="270"
    android:startColor="#ff020202"
    android:endColor="#ff272D33d"
    android:type="linear" />
</shape>

and till now, everything is just awesome!!!

I am now trying to create a button, but cannot find the correct background:

Following source: https://github.com/android/platform_frameworks_base/blob/master/core/res/res/drawable/btn_default.xml

I tried this:

<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_window_focused="false" android:state_enabled="true"
    android:drawable="@drawable/btn_default_normal" />
<item android:state_window_focused="false" android:state_enabled="false"
    android:drawable="@drawable/btn_default_normal_disable" />
<item android:state_pressed="true" 
    android:drawable="@drawable/btn_default_pressed" />
<item android:state_focused="true" android:state_enabled="true"
    android:drawable="@drawable/btn_default_selected" />
<item android:state_enabled="true"
    android:drawable="@drawable/btn_default_normal" />
<item android:state_focused="true"
    android:drawable="@drawable/btn_default_normal_disable_focused" />
<item
     android:drawable="@drawable/btn_default_normal_disable" />

And I copied every .9.png file into my drawable folder.

But Unfortunately, all these drawable seems rather white and I cannot get something similar to this button:

http://cdn3.staztic.com/screenshots/combourkekitchentimer-2-0.jpg

Here are all resource:

btn_default_normal_holo_dark.9.png

enter image description here

btn_default_normal_holo_light.9.png

enter image description here

btn_default_normal.9.png

enter image description here

Waza_Be
  • 39,407
  • 49
  • 186
  • 260

1 Answers1

4

I had to choose Holo Dark theme:

<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/btn_default_normal_holo_dark" android:state_enabled="true" android:state_window_focused="false"/>
    <item android:drawable="@drawable/btn_default_disabled_holo_dark" android:state_enabled="false" android:state_window_focused="false"/>
    <item android:drawable="@drawable/btn_default_pressed_holo_dark" android:state_pressed="true"/>
    <item android:drawable="@drawable/btn_default_focused_holo_dark" android:state_enabled="true" android:state_focused="true"/>
    <item android:drawable="@drawable/btn_default_normal_holo_dark" android:state_enabled="true"/>
    <item android:drawable="@drawable/btn_default_disabled_focused_holo_dark" android:state_focused="true"/>
    <item android:drawable="@drawable/btn_default_disabled_holo_dark"/>

</selector>
Waza_Be
  • 39,407
  • 49
  • 186
  • 260