我有以下代碼,它使用手勢來執行滾動我的hfm,但覆蓋此hfm,本質上覆蓋屏幕上的所有字段,使它們無用。這怎麼可能,我認爲這個特定的touchEvent屬於hfm?我如何解決這個問題,只是禁用觸摸滾動hfm?黑莓:覆蓋觸摸事件的經理覆蓋所有其他領域
gallery = new CustomHFM(){
protected void sublayout(int maxWidth, int maxHeight){
super.sublayout(maxWidth, 200);
setExtent(maxWidth,200);
}
protected boolean touchEvent(TouchEvent message){
int eventCode = message.getEvent();
if(eventCode == TouchEvent.GESTURE){
System.out.println("SWIPE GESTURE");
TouchGesture g = message.getGesture();
int gesturecode = g.getEvent();
int direction = g.getSwipeDirection();
//gallery.setHorizontalScroll(page_two, true);
if(direction == TouchGesture.SWIPE_WEST)
slideNext();
if(direction == TouchGesture.SWIPE_EAST)
slidePrev();
pressed = true;
}
if(eventCode == TouchEvent.UP){
pressed = false;
//slide();
}
return true;
}
};
在SWIPE_WEST和EAST下添加return true,並且super.touchEvent(消息)不起作用 – Adam 2012-01-17 14:55:25