如何在Wear应用中使用Android Wear Wrist Gestures?是否可以检测它们,例如滚动手腕滚动?
答案 0 :(得分:0)
如果您在活动中注册了回调onKeyDown()
,系统会通知您以下events:KEYCODE_NAVIGATE_NEXT
,
KEYCODE_NAVIGATE_PREVIOUS
,KEYCODE_NAVIGATE_IN
和KEYCODE_NAVIGATE_OUT
。这些新手势将映射到这些事件。所以这是一个快速覆盖:
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
Log.d(TAG, "onKeyDown Keycode: " + keyCode);
switch (keyCode) {
case KeyEvent.KEYCODE_NAVIGATE_NEXT:
// Do something that advances user view to the next item in an ordered list
return true;
case KeyEvent.KEYCODE_NAVIGATE_PREVIOUS:
// Do something that advances user view to the previous item in an ordered list
return true;
case KeyEvent.KEYCODE_NAVIGATE_IN:
// Do something that activates the item that currently has focus or expands to
// the next level of a navigation hierarchy
return true;
case KeyEvent.KEYCODE_NAVIGATE_OUT:
// Do something that backs out one level of a navigation hierarchy or collapses
// the item that currently has focus.
return true;
default:
// If you did not handle, then let it be handled by the next possible element as
// deemed by Activity.
return super.onKeyDown(keyCode, event);
}
}
答案 1 :(得分:0)
我相信你会发现HandsFree Wear应用程序很有趣(我是创造者),你可以通过手腕手势(几乎)完全使用你的智能手表。