Two titile bars on a single screen in BlackBerry

為{幸葍}努か 提交于 2019-12-25 07:59:06

问题


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:


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);
    }
}


来源:https://stackoverflow.com/questions/10928625/two-titile-bars-on-a-single-screen-in-blackberry

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!