本文介绍了Android版的SmartWatch到Long_ preSS事件作出回应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的索尼爱立信智能手表应对触摸事件相当不错。现在我必须转移到其他的相互作用。是否有一个LONG_ $ P $干燥综合征事件实施还是我只是用一个事实,即有几个下来的事件和一起来?

I have my sonyericsson Smart Watch responding to Touch events quite nicely. Now I have to move on to other interactions. Is there a LONG_PRESS event implemented or do I just use the fact that there are several down events and one up?

一SWIPE_EVENT的一个例子是欢迎了。

An example of a SWIPE_EVENT would be welcome too.

推荐答案

本的SmartWatch支持通过发送触摸事件和刷卡事件控制扩展。对于触摸,你将如获得$ P $干燥综合征,释放和LONG $ P $干燥综合征事件与坐标一起。所以,是的,TOUCH_ACTION_LONG $ P $干燥综合征实现。例如:

The SmartWatch supports the control extensions by sending touch events and swipe events. For touch, you will e.g. get PRESS, RELEASE and LONGPRESS events along with the coordinates. So yes, TOUCH_ACTION_LONGPRESS is implemented. Example:

@Override
public void onTouch(final ControlTouchEvent event) {
    int action = event.getAction();
    switch(action) {
        case Control.Intents.TOUCH_ACTION_PRESS:
            // Do
            break;
        case Control.Intents.TOUCH_ACTION_RELEASE:
            // Do other
            break;
        case Control.Intents.TOUCH_ACTION_LONGPRESS:
            // Do more
            break;
        default:
            break;
    }
}

和为轻扫,你会得到轻扫的方向。

And for swipe, you will get the direction of the swipe.

@Override
public void onSwipe(int direction) {
    switch (direction) {
        case Control.Intents.SWIPE_DIRECTION_UP:
            break;
        case Control.Intents.SWIPE_DIRECTION_LEFT:
            break;
        case Control.Intents.SWIPE_DIRECTION_DOWN:
            break;
        case Control.Intents.SWIPE_DIRECTION_RIGHT:
            break;
        default:
            break;
    }
}

我们刚刚发布两个扩展开源为了您的方便:的SmartWatch开源公告。尤其是8场比赛延伸有一些很好的例子你所要求的,即触摸和滑动的例子。

We just published two extensions as open source for your convenience: SmartWatch open source announcement. Especially the 8 game extension has some nice examples of what you are asking for, i.e. examples of touch and swipe.

和到智能扩展SDK

希望这有助于!

这篇关于Android版的SmartWatch到Long_ preSS事件作出回应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!