禁用垂直字段管理器中的滚动

时间:2011-05-21 11:45:26

标签: blackberry

我有两个垂直字段管理器,我想在第一个上启用滚动,在第二个上禁用它。因此,当我滚动一个verticalfield管理器时,滚动并且所有其他内容保持不变。 只是myv2应滚动 目前整个屏幕滚动。

    final TweetOptionsVerticalFieldManager myv = new TweetOptionsVerticalFieldManager(USE_ALL_WIDTH | NO_VERTICAL_SCROLLBAR | VerticalFieldManager.NO_VERTICAL_SCROLL){

    //override in order to set maximum height for the manager
    protected void sublayout( int maxWidth, int maxHeight )
    {
        //set width
        int displayWidth = Display.getWidth();
        //set height
        int displayHeight = tweetBtnManager.getHeight() + Constants.HEADER_LOGO.getHeight();

        super.sublayout( displayWidth, maxHeight);
        setExtent( displayWidth, displayHeight);
    }

}; 

    TwitterMainVerticalFieldManager2 myv2 = new TwitterMainVerticalFieldManager2(USE_ALL_HEIGHT | USE_ALL_WIDTH | VERTICAL_SCROLLBAR | VERTICAL_SCROLL){

    //override in order to set maximum height for the manager
    protected void sublayout( int maxWidth, int maxHeight )
    {
        //set width
        int displayWidth = Display.getWidth();
        //set height
  //      int displayHeight = Display.getHeight() - tweetBtnManager.getHeight() - tweetBtnManager.getPaddingTop() - tweetBtnManager.getPaddingBottom() - Constants.HEADER_LOGO.getHeight();

        int displayHeight = Display.getHeight();

        super.sublayout( displayWidth, displayHeight);
        setExtent( displayWidth,  displayHeight - myv.getHeight());
    }

}; 

    add(myv);
    add(myv2);

1 个答案:

答案 0 :(得分:1)

此代码

add(myv);
add(myv2);

实际上将您的VFM添加到屏幕的内部VFM中,默认情况下该VFM具有滚动功能。所以我怀疑你只是观察来自内部屏幕的VFM的滚动。

要禁用滚动屏幕的内部VFM,请将相同的滚动禁用样式传递给屏幕的构造函数:

// YourScreen constructor
public YourScreen() {
    super(NO_VERTICAL_SCROLL | NO_VERTICAL_SCROLLBAR);
    // the rest of the code that creates/adds child fields
}