问题
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