在VerticalFieldManager设置页眉和页脚黑莓 [英] set header and footer in BlackBerry in VerticalFieldManager

查看:138
本文介绍了在VerticalFieldManager设置页眉和页脚黑莓的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我搜索了如何设置页眉和页脚的黑莓手机,我发现功能的setTitle() setStatus()

I searched how to set header and footer in BlackBerry and I found the functions setTitle() and setStatus().

我的问题是我已经创建了扩展 VerticalFieldManager A类。在 VerticalFieldManager ,它没有显示我 setStatus 的功能,因为这是 MainScreen 类。

My problem is I have created a class that extends VerticalFieldManager. In VerticalFieldManager, it is not showing me setStatus function as this is function of MainScreen class.

推荐答案

您说得对。 A VerticalFieldManager 不允许你 setStatus()直接

You're right. A VerticalFieldManager does not allow you to setStatus() directly.

要了解在BlackBerry UI框架的类之间的关系是很重要的。

It's important to understand the relationship between the classes in the BlackBerry UI framework.

首先,有屏幕类。通常情况下,屏幕将占据整个设备屏幕。你可以有很多不同的屏幕班在您的应用程序。也许有屏幕的开机画面,一个屏幕的地图视图,一个屏幕的设置等。

First of all, there are Screen classes. Normally, a Screen will take up the entire device screen. You can have many different Screen classes in your app. Maybe one Screen for a splash image, one screen for a map view, one screen for settings, etc.

的你的屏幕,你会经常有管理​​类。 A VerticalFieldManager 是一种管理​​自顶至底排列其内容,在您添加的顺序。 A 管理​​拥有一组相关的对象,但它不具备跨越整个屏幕高度或宽度。

Inside your screens, you will often have Manager classes. A VerticalFieldManager is a kind of Manager that arranges its contents top-to-bottom, in the order that you add them. A Manager holds a group of related objects, but it does not have to span the full screen height, or width.

的你的经理,你通常有多个字段的对象。 A 字段是层次结构的个别项目。 ButtonField字段 EditField中 BrowserField 都是各个领域。他们通常会被添加到管理器(容器)。这些管理者会那么通常被添加到屏幕。

Inside your managers, you will usually have multiple Field objects. A Field is the individual item in the heirarchy. ButtonField, EditField, or BrowserField are all kinds of fields. They will usually be added to managers (containers). Those managers will then usually be added to screens.

所以,你的情况,我觉得你应该有一个屏幕类。在该屏幕类,你会设置的的和的页脚的调用的setTitle() setStatus()。页眉和页脚之间的内容都将包含在 VerticalFieldManager 您添加到屏幕上。事情是这样的:

So, in your case, I think what you should have is a screen class. In that screen class, you will set the header and footer by calling setTitle() and setStatus(). The content between the header and footer will all be contained in a VerticalFieldManager that you add to the screen. Something like this:

public class MyScreen extends MainScreen {

   public MyScreen() {
      super(MainScreen.VERTICAL_SCROLL | MainScreen.VERTICAL_SCROLLBAR);

      // set a header for this screen
      setTitle("My Header / Title");

      // screen contents go in the vertical field manager

      // NOTE:  you can replace VerticalFieldManager with your own class
      //   that extends Manager, or VerticalFieldManager, if you like
      VerticalFieldManager vfm = new VerticalFieldManager();
      vfm.add(new LabelField("One"));
      vfm.add(new ButtonField("Two", ButtonField.CONSUME_CLICK));
      vfm.add(new CheckboxField("Three", true));

      add(vfm);

      // use a bitmap as a footer
      Bitmap footer = Bitmap.getBitmapResource("footer.png");
      setStatus(new BitmapField(footer));
   }
}

这篇关于在VerticalFieldManager设置页眉和页脚黑莓的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆