Android源码--多击事件

来源:互联网 发布:知乎 爬虫 下拉加载 编辑:程序博客网 时间:2024/06/06 01:58
private long[] mHits = new long[2];/** * 以下是系统的多击事件--拓展性极强 * src the source array to copy the content.被copy的数组 * srcPos the starting index of the content in src.被copy的数组的起始位置 * dst the destination array to copy the data into.copy的目的数组 * dstPos the starting index for the copied content in dst.copy目的数组的起始位置 * length the number of elements to be copied.copy的长度 */System.arraycopy(mHits, 1, mHits, 0, mHits.length-1);mHits[mHits.length-1] = SystemClock.uptimeMillis();//手机开机时间if (mHits[0] >= (SystemClock.uptimeMillis()-1500)) {//执行双击事件//你的逻辑}}

以下图片以三击事件为例:


0 0
原创粉丝点击