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

发布于 2024-11-08 16:44:08 字数 1492 浏览 0 评论 0原文

我有两个垂直字段管理器,我想在第一个上启用滚动并在第二个上禁用它。因此,当我滚动时,只有一个垂直字段管理器滚动,所有其他内容都保持在原位。 只有 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);

I have two vertical field managers, I want to enable scrolling on the first and disable it on the second. So as I scroll just one verticalfield manager scrolls and all other content remains in place.
Just myv2 should scroll
Currently the entire screen scrolls.

    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);

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

卷耳 2024-11-15 16:44:09

该代码

add(myv);
add(myv2);

实际上将您的 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
}

This code

add(myv);
add(myv2);

actually adds your VFMs to the screen's internal VFM, which by default has scrolling. So I suspect you just observe srolling originated from the internal screen's VFM.

To disable scrolling of the screen's internal VFM pass the same scrolling disabling style to the screen's constructor:

// YourScreen constructor
public YourScreen() {
    super(NO_VERTICAL_SCROLL | NO_VERTICAL_SCROLLBAR);
    // the rest of the code that creates/adds child fields
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文