Skip to content Skip to sidebar Skip to footer

Location Of Holo Focused Button Drawable

Does anyone know what is the location of Holo theme focused button drawable? I would like to set it to my View on some event, but I can't find it.

Solution 1:

1.first locate following location in your android sdk platforms folder -

yourandroidsdkrootfolderpath\platforms\android-11\data\res\drawable (ex:D:\android\platforms\android-11\data\res\drawable)

2.find the xml file on folder named as btn_default_holo_dark.xml and it's contain like below code:

<selectorxmlns:android="http://schemas.android.com/apk/res/android"><itemandroid:state_window_focused="false"android:state_enabled="true"android:drawable="@drawable/btn_default_normal_holo_dark" /><itemandroid:state_window_focused="false"android:state_enabled="false"android:drawable="@drawable/btn_default_normal_disable_holo_dark" /><itemandroid:state_pressed="true"android:drawable="@drawable/btn_default_pressed_holo_dark" /><itemandroid:state_focused="true"android:state_enabled="true"android:drawable="@drawable/btn_default_selected_holo_dark" /><itemandroid:state_enabled="true"android:drawable="@drawable/btn_default_normal_holo_dark" /><itemandroid:state_focused="true"android:drawable="@drawable/btn_default_normal_disable_focused_holo_dark" /><itemandroid:drawable="@drawable/btn_default_normal_disable_holo_dark" /></selector>

3.copy xml to your project drawable folder

4.copy drawable-hdpi,drawable-ldpi,drawable-mdpi images mentioned above xml like

btn_default_normal,btn_default_normal_disable,btn_default_pressed,btn_default_selected,btn_default_normal,btn_default_normal_disable_focused,btn_default_normal_disable

5.add style to your style.xml file like below

<stylename="Custombutton"parent="Widget.Button"><itemname="android:background">@android:drawable/btn_default_holo_dark</item><itemname="android:textAppearance">?android:attr/textAppearanceMedium</item><itemname="android:textColor">@android:color/primary_text_holo_dark</item><itemname="android:minHeight">48dip</item><itemname="android:minWidth">64dip</item></style>

6.apply your button style like below code:

 <Button
    android:id="@+id/button1"
    android:layout_width="wrap_content"
    style="@style/Custombutton"
    android:layout_height="wrap_content"
    android:text="Button" />

Solution 2:

Hdpi versions:

/<android sdk path>/platforms/android-15/data/res/drawable-hdpi/btn_default_disabled_holo.9.png
/<android sdk path>/platforms/android-15/data/res/drawable-hdpi/btn_default_focused_holo.9.png
/<android sdk path>/platforms/android-15/data/res/drawable-hdpi/btn_default_normal_holo.9.png
/<android sdk path>/platforms/android-15/data/res/drawable-hdpi/btn_default_pressed_holo.9.png

other resolutions are in drawable-ldpi,drawable-mdpi,drawable-xhdpi directories.

Post a Comment for "Location Of Holo Focused Button Drawable"