android双击熄屏代码,Android响应双击屏幕事件
[android]代码库private class OnTouchListenerImpl implements OnTouchListener {long firClick;long secClick;@Overridepublic boolean onTouch(View v, MotionEvent event) {// TODO Auto-generated method stubif (
·
[android]代码库private class OnTouchListenerImpl implements OnTouchListener {
long firClick;
long secClick;
@Override
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
if (event.getAction() == MotionEvent.ACTION_DOWN) {
firClick = secClick;
secClick = System.currentTimeMillis();
if (secClick - firClick < 1000) {
Toast.makeText(DongLinSi.this, "双击", Toast.LENGTH_LONG)
.show();
}
}
return false;
}
}
更多推荐
已为社区贡献2条内容
所有评论(0)