android 触摸屏滑动事件,对应的最小底层事件集

android 触摸屏滑动事件,对应的最小底层事件集到底是怎样的?

当进行滑动操作时,可以通过EventHub Log捕捉到产生的底层events,

也可以使用下面的命令:

$ adb shell getevent


但是产生的events非常多,这些events当中,有很多不是关键的。

试了好久,终于得到最精简的结果:


说明:
type=0, 表示 sync
type=1, 表示 key
type=3, code=53,54,   value 表示 x,y的值
type=3, code=48,50,57,58,   value 表示触摸工具属性

struct event {
    int type;
    int code;
    int value;
};


以下是下滑操作的必须事件:

{3,53,240}, {3,54,400},
{1,330,1},
{3,58,255},
{0,0,0},


{3,53,240},{3,54,450},{3,58,255},
{0,0,0},


{3,58,0},
{1,330,0},     
{0,0,0}


即:

1.  多点坐标->按下->压力->同步

2. 下一个多点坐标->压力->同步

3. 压力清零->抬起->同步


以下是linux输入的事件表示说明:


Input.h (kernel/include/linux)
event-codes.txt (kernel/Documentation/input)

type=0 : EV_SYN     input_sync
type=1 : EV_KEY     input_report_key
type=2 : EV_REL     input_report_rel
type=3 : EV_ABS     input_report_abs
type=4 : EV_MSC     input_event( input_dev, type, code, value ), 参数type赋值为EV_MSC


event: type=0, code=0,  value=0.    // 表示 SYN_REPORT
event: type=0, code=2,  value=0.    // 表示 SYN_MT_REPORT

event: type=1, code=62, value=1.    // 表示 KEY_F4 被按下
event: type=1, code=62, value=0.    // 表示 KEY_F4 抬起

event: type=1, code=330,value=1.    // 表示 BTN_TOUCH 被按下
event: type=1, code=330, value=0.   // 表示 BTN_TOUCH 抬起

event: type=2, code=0, value=5.     // 表示 REL_X = 5
event: type=2, code=1, value=-8.    // 表示 REL_Y = -8

event: type=3, code=0, value=5.     // 表示 ABS_X = 5
event: type=3, code=1, value=8.     // 表示 ABS_Y = 8

event: type=3, code=48, value=3.
event: type=3, code=50, value=1.    // 这两个事件表示触摸工具

event: type=3, code=53, value=126.
event: type=3, code=54, value=748.  // 这两个事件表示ABS_MT_POSITION坐标点(126,748)

event: type=3, code=58, value=255.  // 表示:接触工具对屏幕的压力大小
event: type=3, code=57, value=0.    // ABS_MT_TRACKING_ID


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值