如何为黑莓屏幕创建固定背景?
我想为屏幕创建一个背景,当屏幕滚动时该背景不会移动。我当前的代码类似于:
Bitmap bitmap = Bitmap.getBitmapResource("background.png");
setBackground(BackgroundFactory.createBitmapBackground(bgBmp));
但是,这将创建一个松散的背景,这意味着如果屏幕字段超出显示范围,当用户滚动屏幕时,背景也会移动,从而使屏幕的某些部分没有背景。我不想让背景在拉伸的部分一遍又一遍地重复。然而,我真正想要的是一个固定在显示屏上的背景,并且其余字段在其顶部滚动。您知道有什么直接或间接的方法可以做到这一点吗?
I want to create a background for a screen that will not move when the screen is scrolled. My current code is something like:
Bitmap bitmap = Bitmap.getBitmapResource("background.png");
setBackground(BackgroundFactory.createBitmapBackground(bgBmp));
However this will create a loose background, meaning that if screen fields stretch out of the display, when user scrolls the screen the background will move as well leaving some part of the screen background-less. I do not want to make the background repeat itself over and over for the stretched parts. What I do want however is a background that stays pinned to the display and the rest of the fields scroll on top of it. Do you know any direct or indirect way for doing this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将背景添加到不滚动的管理器。添加另一个管理器来保存所有字段并允许其滚动。所以它会是这样的:
Add the background to a manager that does not scroll. Add another manager to that to hold all of your fields and allow it to scroll. So it would be something like:
使用以下代码设置以位图作为背景的屏幕背景。
Use following code to set background of screen which have bitmap as background.