My Glass已更新至XE16,此后Glassware中使用的Viewpage无法正常工作。通过刷卡无法移动到任何寻呼机。如果以前有人遇到此问题,请提供帮助。
由于
答案 0 :(得分:0)
嘿。是的,更新删除了某些标准事物(如触摸板移动焦点上的手势等)。
你要做的是实现一个手势识别器/监听器并实现必要的字段,如下所示(不要忘记在活动中实例化/实现/导入等等)):
private GestureDetector createGestureDetector(Context context) {
GestureDetector gestureDetector = new GestureDetector(context);
//Create a base listener for generic gestures
gestureDetector.setBaseListener( new GestureDetector.BaseListener() {
@Override
public boolean onGesture(Gesture gesture) {
if (gesture == Gesture.TAP) {
// do something on tap
//do ?
return false;
} else if (gesture == Gesture.TWO_TAP) {
// do something on two finger tap
return true;
} else if (gesture == Gesture.LONG_PRESS) {
// do something on long press
if (!showingMenu)
{
openOptionsMenu();
return true;
}
else
{
return false;
}
} else if (gesture == Gesture.SWIPE_RIGHT) {
// do something on right (forward) swipe
//next slide:
mPosition++;
if (mPosition >= cardArray.size())
{
mPosition = cardArray.size() -1;
}
mGallery.setSelection(mPosition);
return true;
} else if (gesture == Gesture.SWIPE_LEFT) {
// do something on left (backwards) swipe
//previous slide:
mPosition--;
if (mPosition < 0)
{
mPosition = 0;
}
mGallery.setSelection(mPosition);
return true;
}
return false;
}
});
gestureDetector.setFingerListener(new GestureDetector.FingerListener() {
@Override
public void onFingerCountChanged(int previousCount, int currentCount) {
// do something on finger count changes
}
});
/*gestureDetector.setScrollListener(new GestureDetector.ScrollListener() {
@Override
public boolean onScroll(float displacement, float delta, float velocity) {
// do something on scrolling
if (delta > 5.0f)
{
//scroll forwards:
//
}
else if (delta < -5.0f)
{
//scroll backwards:
//
}
return false;
}
});*/
return gestureDetector;
}
/*
* Send generic motion events to the gesture detector
*/
@Override
public boolean onGenericMotionEvent(MotionEvent event) {
if (mGestureDetector != null) {
return mGestureDetector.onMotionEvent(event);
}
return false;
}
答案 1 :(得分:0)
我用CardScrollView取代了我的Viewpager,它也非常快。 试试吧。