解决方案 »
- android中同一个activity中设置两个button怎么区别?
- xml问题
- android 有没有办法使dialog与控件对齐
- Log怎么输出行号?
- 读取AndroidManifest.xml
- 怎么捕获点击的文件的文件名及路径
- 手机睡眠时关闭GPU是在安卓上层操作的吗?
- 关于物件获取焦点问题
- 急急急 求解答!!!!
- 求教:安卓开发遇到下面报错java.lang.IllegalStateException: Could not execute method of th
- android中的save restore方法的理解
- 对于复制android手机系统文件到PC上各位大牛有什么好办法!!!
可以百度下 android selector
btn_play.xml <selectorxmlns:android="http://schemas.android.com/apk/res/android"> <itemandroid:drawable="@drawable/img_btn_play_pressed" android:state_focused="true" android:state_pressed="true"/> <itemandroid:drawable="@drawable/img_btn_play_pressed" android:state_focused="false" android:state_pressed="true"/> <itemandroid:drawable="@drawable/img_btn_play_pressed" android:state_focused="true"/> <itemandroid:drawable="@drawable/img_btn_play" android:state_focused="false" android:state_pressed="false"/></selector>
在布局文件中引用btn_play.xml
<ImageButton
android:id="@+id/btnPlay" android:src="@drawable/btn_play" android:layout_width="wrap_content" android:layout_height="wrap_content"
android:background="@null"/>
那楼主把onClick事件换成onTouch事件吧,分别在down、up响应时设置不同的背景图片