Two titile bars on a single screen in BlackBerry

2019-09-06 21:50发布

I am trying to build a screen in BlackBerry. In which there should be a second title bar just below the original title bar. Also the second title bar should be fixed and it should not be scrolled with vertical scroll.

Need some advice on this issue.

1条回答
别忘想泡老子
2楼-- · 2019-09-06 21:58

You can add the second title and the original title bar on a VerticalFieldManager. Then just set that VerticalFieldManager as title, as it's possible to set any Field, Manager instance as title.

Check public void setTitle(Field title) and following example.

public class DemoScreen extends MainScreen {
    public DemoScreen() {
        super();

        // Prepare a Custom Title
        long style = NO_VERTICAL_SCROLL | NO_VERTICAL_SCROLLBAR | USE_ALL_WIDTH;
        VerticalFieldManager myTitle = new VerticalFieldManager(style);

        // Set background color.
        myTitle.setBackground(BackgroundFactory.createSolidBackground(Color.GRAY));

        // Add any numbers/types of field
        myTitle.add(new LabelField("First line."));
        myTitle.add(new LabelField("The second line."));

        // Set the Title
        setTitle(myTitle);
    }
}
查看更多
登录 后发表回答