http://blog.csdn.net/android_tutor/article/details/5995759
如何根据控件的三种状态:normal(正常状态);focus(焦点状态),pressed(按下状态)。来显示相应的图片:
1,在res/drawable目录下定义一个资源文件
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_window_focused="false" android:drawable="@drawable/handle_normal" />
<item android:state_focused="true" android:drawable="@drawable/handle_focused" />
<item android:state_pressed="true" android:drawable="@drawable/handle_pressed" />
</selector>
2,给控件添加背景
<Button
android:id="@+id/handle"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:background="@drawable/handle"
/>