禁用垂直字段管理器中的滚动
我有两个垂直字段管理器,我想在第一个上启用滚动并在第二个上禁用它。因此,当我滚动时,只有一个垂直字段管理器滚动,所有其他内容都保持在原位。 只有 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该代码
实际上将您的 VFM 添加到屏幕的内部 VFM,默认情况下具有滚动功能。所以我怀疑你只是观察到源自内部屏幕 VFM 的滚动。
要禁用屏幕内部 VFM 的滚动,请将相同的滚动禁用样式传递给屏幕的构造函数:
This code
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: