Android戴5.1手腕手势API?

Android Wear 5.1 wrist gesture API?

Android 5.1.1 可穿戴设备引入了通过 rotating/flicking 手腕关闭通知的功能。这个 API 是公开给开发者使用的吗?我找不到这方面的任何信息,而且他们的可穿戴设备开发者网站似乎没有更新。

不,目前没有适用于 Wear 1.0 设备的手腕手势 API,这就是开发者网站未提及手腕手势的原因。

似乎有点晚了,但 this 看起来正是您想要的。

虽然推、抬、摇手势不可用,但甩腕手势可用。

Each wrist gesture is mapped to an int constant from the KeyEvent class, as shown in the following table:

Flick wrist out: KEYCODE_NAVIGATE_NEXT, This key code goes to the next item.

Flick wrist in: KEYCODE_NAVIGATE_PREVIOUS, This key code goes to the previous item.

您可以这样处理事件:(来自开发者文档的示例代码)

public boolean onKeyDown(int keyCode, KeyEvent event) {
  switch (keyCode) {
   case KeyEvent.KEYCODE_NAVIGATE_NEXT:
    // Do something that advances a user View to the next item in an ordered list.
    return moveToNextItem();
   case KeyEvent.KEYCODE_NAVIGATE_PREVIOUS:
    // Do something that advances a user View to the previous item in an ordered list.
    return moveToPreviousItem();
  }
  // If you did not handle it, let it be handled by the next possible element as deemed by the Activity.
  return super.onKeyDown(keyCode, event);
 }