在黑莓应用程序中向屏幕添加垂直滚动条

发布于 2024-08-26 03:34:22 字数 158 浏览 4 评论 0原文

嗨,我是黑莓开发的新手。

我试图在屏幕上添加垂直滚动条,但无法做到这一点。因为我不认识路。 VerticalScrollManger 滚动 = new VerticalScrollManager(Manager.VERTICAL_SCROLL);

请给我解决方案。 谢谢

hi I am new to blackberry development..

I am trying to add a vertical scroll bar on the screen, but not able to do that. because I do not know the way.
VerticalScrollManger scroll = new VerticalScrollManager(Manager.VERTICAL_SCROLL);

please give me the solution.
thanks

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

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

发布评论

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

评论(3

青丝拂面 2024-09-02 03:34:22

扩展 net.rim.device.api.ui.Manager 的东西(如 VerticalFieldManager)可以在构造函数中设置样式位,指定您想要的滚动类型以及是否应显示滚动条(箭头) 。将您的字段放入已启用滚动的管理器中,并为屏幕设置管理器您需要设置包含对于屏幕来说太大的组件/字段的管理器,以启用滚动并绘制滚动条以查看滚动箭头。

您要设置的样式位是: Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR

如果您的 UI 构建在黑莓类 MainScreen 或 FullScreen 之上,则可以使用采用 long 类型参数的构造函数来设置样式位:MainScreen(long style) 可以被称为 MainScreen(Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR); 来设置屏幕的样式位以包括滚动和垂直滚动指示器箭头。

偶尔会出现一个问题,即固定大小的 FieldManager 有时不会显示滚动箭头(但它们仍会滚动)。如果您担心以下问题,请参阅具有固定大小的 Blackberry VerticalFieldManager:滚动问题那个问题。

Things that extends net.rim.device.api.ui.Manager (like a VerticalFieldManager) can have style bits set in the constructor that specify which type(s) of scrolling you want and whether or not the scrollbars (arrows) should be displayed. Put your Field into a manager that has scrolling enabled and set the manager for the screen You need to set the manager containing the component/field that is too large for the screen to have scrolling enabled AND scrollbars drawn to see scroll arrows.

The style bits you want to set are: Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR

If your UI is built on top of the blackberry classes MainScreen or FullScreen, you can use the constructor taking an argument of type long to set the style bits: MainScreen(long style) could be called as MainScreen(Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR); to set the style bits for the screen to include scrolling and vertical scroll indicator arrows.

There is an occasional issue that FieldManagers that are fixed size will sometimes not show scroll arrows (but they'll still scroll). See Blackberry VerticalFieldManager with fixed size : Scroll issue if you are concerned about that issue.

江挽川 2024-09-02 03:34:22

如果滚动条指的是蓝色小箭头,那么您可以使用上面描述的 Jessica 方法(设置样式位 VERTICAL_SCROLLVERTICAL_SCROLLBAR)来显示它们。但是,如果通过滚动条您指的是指示滚动位置的实际条(如浏览器应用程序中所示),那么您需要自己在管理器上绘制这些条,因为 BlackBerry API 不为您提供任何显示方式自动地。

要执行类似的操作,您需要子类化 VerticalFieldManager 并重写 paint 方法。使用屏幕高度 (Display.getHeight())、管理器高度 (getVirtualHeight()) 和滚动位置 (getVerticalScroll()) 的组合code>) 计算条形的 Y 位置和高度,然后使用 g.drawRect() 或类似的方法将其绘制在屏幕上。

If by scrollbars you mean the small blue arrows, then you can get these to display using the method Jessica described above (set style bits VERTICAL_SCROLL and VERTICAL_SCROLLBAR). However, if by scrollbars you are referring to actual bars that indicate the scrolled position (as seen in the Browser app) then you would need to draw these on the manager yourself, as the BlackBerry API doesn't provide you with any way to display them automatically.

To do something like that you'd need to subclass VerticalFieldManager and override the paint method. Use a combination of the screen height (Display.getHeight()), the manager height (getVirtualHeight()) and the scroll position (getVerticalScroll()) to calculate the Y position and height of the bar, and then draw it on the screen using g.drawRect() or something similar.

べ映画 2024-09-02 03:34:22

如果您想要一个更漂亮的滚动条,请查看我在黑莓知识库中的文章:
http://supportforums.blackberry.com/t5/Java-Development/Implementing-a-standard-style-scrollbar-on-a-Blackberry-device/ta-p/504416

If you want a fancier-looking scrollbar, take a look at my article in BlackBerry knowledge base:
http://supportforums.blackberry.com/t5/Java-Development/Implementing-a-standard-style-scrollbar-on-a-Blackberry-device/ta-p/504416

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文