使用 Blackberry JAVA SDK 6.0 活动指示器 UI 元素加载屏幕轮
在我的项目中,我想在发生 http 连接时显示带有滚轮图像(可能带有 .gif 文件)的加载屏幕。
我的代码如下。它扩展了一个类,该类扩展了 MainScreen。当用户单击登录按钮时,我显示此屏幕。
public class MSWheelScreen extends MSScreen{
//Constructor
public MSWheelScreen(){
super();
add(new SeparatorField());
add(new LabelField("Loading...", Field.FIELD_HCENTER));
add(new SeparatorField());
add(new LabelField());
ActivityIndicatorView myview = new ActivityIndicatorView(Field.USE_ALL_WIDTH);
ActivityIndicatorModel mymodel = new ActivityIndicatorModel();
ActivityIndicatorController mycontroller = new ActivityIndicatorController();
myview.setController(mycontroller);
myview.setModel(mymodel);
mycontroller.setModel(mymodel);
mycontroller.setView(myview);
mymodel.setController(mycontroller);
Bitmap mybitmap = Bitmap.getBitmapResource("img/wheel.gif");
myview.createActivityImageField(mybitmap, 5, Field.FIELD_HCENTER);
add(myview);
}
}
反正;我的问题是,我无法按我想要的方式显示车轮图像。我只能看到轮子的一部分,当我在浏览器中打开它时,我无法看到整个 .gif 文件。所以我想调整我在加载屏幕上添加的 .gif 文件。我想知道一些内置方法,我可以将它们与活动指示器 UI 元素一起使用来调整我的 gif。
我的示例运行屏幕截图的链接:
http://imageshack.us/photo/ my-images/191/9800j.jpg/
原始 gif 的链接。
In my project,I want to show a loading screen with a rolling wheel image(possibly with a .gif file) while my http connection occured.
My code is below. It extends a class which extends MainScreen. I show this screen when the user clicked login button.
public class MSWheelScreen extends MSScreen{
//Constructor
public MSWheelScreen(){
super();
add(new SeparatorField());
add(new LabelField("Loading...", Field.FIELD_HCENTER));
add(new SeparatorField());
add(new LabelField());
ActivityIndicatorView myview = new ActivityIndicatorView(Field.USE_ALL_WIDTH);
ActivityIndicatorModel mymodel = new ActivityIndicatorModel();
ActivityIndicatorController mycontroller = new ActivityIndicatorController();
myview.setController(mycontroller);
myview.setModel(mymodel);
mycontroller.setModel(mymodel);
mycontroller.setView(myview);
mymodel.setController(mycontroller);
Bitmap mybitmap = Bitmap.getBitmapResource("img/wheel.gif");
myview.createActivityImageField(mybitmap, 5, Field.FIELD_HCENTER);
add(myview);
}
}
Anyway; my problem is that, I cant show the wheel image as i wanted. I can only see the part of the wheel, i am not able to see the whole .gif file as i open it in a browser. So i want to adjust the .gif file that i have added on the loading screen. I want to know some built in methods that i can use with activity indicator UI elements to adjust my gif.
The link for my sample run screenshot:
http://imageshack.us/photo/my-images/191/9800j.jpg/
The link for original gif.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 .gif 实现加载屏幕很困难,因为它需要多一个处理 .gif 图像的线程
所以我总是在黑莓中实现加载屏幕,如下所示:
这是加载屏幕的简单代码....
It is difficult to implement loading screen with .gif bcz it required one more thread that handle .gif image
So i always implement Loading screen in blackberry like this :
This is simple code for loading screen ....