2012-01-17 94 views
0

我试图搭上protected boolean navigationMovement(int dx,int dy,int status,int time)MainScreen子类,我有一个PictureScrollField添加到它。如果我没有超过它,那么PictureScrollField正常工作,但当我超过它,然后currentImageIndex保持固定为零,它不滚动!我能做些什么来防止这种异常现象,或者有另一种更好的方法来做到这一点?我只想改变当前图像PictureScrollField的字段标题。换句话说,我需要获得currentImageIndex以动态更改屏幕上可见的数据。该字段是自定义字段,因此我无法使用ScrollEntry的标签/标注功能。覆盖导航移动错误的PictureScrollField

编辑:我正在覆盖protected boolean navigationMovement(int dx,int dy,int status,int time)和返回false但这是行不通的。

+0

对不起,我不明白;简单地告诉我; – alishaik786 2012-01-18 05:53:48

+0

更新的问题! – tipycalFlow 2012-01-18 06:01:25

回答

0

我不得不解决的PictureScrollField的默认行为如下:尽管返回false(这意味着该事件没有被消耗),PictureScrollField没有处理

protected boolean navigationMovement(int dx,int dy,int status,int time){ 
// gallery is an object of PictureScrollField 
    if(gallery.getVisualState()==Field.VISUAL_STATE_FOCUS && dx != 0){ 
     int currentInd = gallery.getCurrentImageIndex() + dx; 
     gallery.selectImageAtCoordinate((dx)*50 + Display.getWidth()/2); 
     // 50 is the width of the gallery object as provided in the constructor 
     // Instead of 50, we can also write gallery.getWidth() 
     // use the current image index as - gallery.getCurrentImageIndex() 
    } 
    return false; 
} 

这很奇怪,不过,导航动作!无论如何,手动设置currentImageIndex同样适用!