public class MainActivity extends AppCompatActivity {
private int count = 0;//点击次数
private long firClick = 0;//第一次点击
private long secClick = 0;//第二次点击
private final int interval = 1500;//连续双击持续时间
private boolean isgone=true;//是否隐藏掉的标识
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
if (MotionEvent.ACTION_DOWN == ev.getAction()) {//按下
count++;
if (1 == count) {
firClick = System.currentTimeMillis();//记录第一次点击时间
} else if (2 == count) {
secClick = System.currentTimeMillis();//记录第二次点击时间
if (secClick - firClick < interval) {
count = 0;
firClick = 0;
if(isgone){//双击屏幕
Toast.makeText(MainActivity.