android – Google Glass:从对话框中选择“取消”或“确定”

如何从像Google Glass XE16这样的系统对话框的选项中移出?

通过XE12,我可以从选项向前和向后滑动.但在更新到XE16后,它不再起作用了.

我只能选择聚焦的第一个选项(在这种情况下取​​消).

更新:
XE17 – 仍然是同一个问题

最佳答案 如果这是您自己的应用程序,无论是使用本机GDK代码还是从某些
Android应用程序移植的代码,您都可以按照以下步骤来支持listview,按钮等和非GDK UI组件的导航:

>添加GestureDetector mGestureDetector;
>添加mGestureDetector = createGestureDetector(this); in onCreate;
>定义两种方法:

项目清单

private GestureDetector createGestureDetector(Context context) {
    GestureDetector gestureDetector = new GestureDetector(context);

    gestureDetector.setBaseListener( new GestureDetector.BaseListener() {
        @Override
        public boolean onGesture(Gesture gesture) {
            if (gesture == Gesture.TAP) { 
                process(mListView.getSelectedItem());
                return true;
            } else if (gesture == Gesture.SWIPE_RIGHT) {
                mListView.setSelection(mListView.getSelectedItemPosition()+1);
                return true;
            } else if (gesture == Gesture.SWIPE_LEFT) {
                mListView.setSelection(mListView.getSelectedItemPosition()-1);
                return true;
            }
            return false;
        }
    });

    return gestureDetector;
}

// this method is required for tap on touchpad to work!
public boolean onGenericMotionEvent(MotionEvent event) {
    if (mGestureDetector != null) {
        return mGestureDetector.onMotionEvent(event);
    }
    return false;
}           

完整的工作样品可在https://github.com/xjefftang/launchy/commit/66f17bd5bf920800ce277df5eeb6ea912b877692获得

点赞