res\drawable\btn_default_small_selected.png
res\drawable\@drawable/btn_default_small_pressed.png
res\drawable\cumtom_btm1.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/btn_default_small_selected" /> <item android:state_window_focused="false" android:state_enabled="false" android:drawable="@drawable/btn_default_small_selected" /> <item android:state_pressed="true" android:drawable="@drawable/btn_default_small_pressed" /> <item android:state_focused="true" android:state_enabled="true" android:drawable="@drawable/btn_default_small_selected" /> <item android:state_enabled="true" android:drawable="@drawable/btn_default_small_selected" /> <item android:state_focused="true" android:drawable="@drawable/btn_default_small_selected" /> <item android:drawable="@drawable/btn_default_small_selected" /> </selector>
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:weightSum="1"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="PowenKo.com" /> <ImageButton android:background="@drawable/cumtom_btm1" android:layout_height="wrap_content" android:id="@+id/imageButton1" android:layout_width="103dp" android:layout_weight="0.07"></ImageButton> </LinearLayout>
sample code:
Tutorial_UI_Cumtom_Button