主要是为了实现长按语音功能使用了setOnTouchListener事件,覆盖了默认操作;
可在motionevent.action_down/action_pointer_down下添加view.setPressed(true);
motionevent.action_up/action_pointer_up下添加view.setPressed(false);
来处理。
xml
<?xml version="1.0" encoding="UTF-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_pressed="false"
android:drawable="@drawable/btn_chicken_off" />
<item
android:state_pressed="true"
android:drawable="@drawable/btn_chicken_s3" />
</selector>