Blackberry - how to define screen title height?
is there开发者_StackOverflow社区 a possibility to define somehow title's height?
The main problem is a separator that is located under the actual title. So, possibly there is possibility to define somehow the separator's height.
API 4.5
Thanks
I have experienced this myself and the only way I know of to get around it is to override the (undocumented) method in MainScreen:
protected void applyTheme() {
// leave this empty
}
This prevents the theme from setting colors and also seems to get rid of the separator between the title and main content.
You'll want to use the setExtent method.
To simply get title height try this:
class Scr extends MainScreen {
public Scr() {
setTitle("Hello!");
Manager contentManager = getMainManager();
Manager screenManager = contentManager.getManager();
Field titleField = screenManager.getField(0);
int height = titleField.getPreferredHeight();
add(new LabelField(String.valueOf(height)));
}
}
And to define title yourself, try to put custom field into setTitle
精彩评论