// 长按触发handle
final Handler handler = new Handler();
final Runnable mLongPressed = new Runnable() {
public void run() {
// 长按处理
AudioRecordManager.getInstance(EventReportActivity.this).startRecord();
}
};
// 手势操作处理
mBtnVoice.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN)
handler.postDelayed(mLongPressed, 1000);
if (event.getAction() == MotionEvent.ACTION_UP) {
handler.removeCallbacks(mLongPressed);
tv_voicehint.setText("");
// 放开处理
AudioRecordManager.getInstance(EventReportActivity.this).stopRecord();
AudioRecordManager.getInstance(EventReportActivity.this).destroyRecord();
}
return true;
}
});
android:监听按钮的长按与松开
最新推荐文章于 2023-05-05 17:47:15 发布
994

被折叠的 条评论
为什么被折叠?



