1

is there 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

Maksym Gontar
  • 22,765
  • 10
  • 78
  • 114
Lyubomyr Dutko
  • 4,486
  • 7
  • 32
  • 39
  • I'm assuming you're talking about the blackberry sdk, however knowing which api version would be helpful. – tplaner Nov 19 '09 at 13:58

3 Answers3

1

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.

Marc Novakowski
  • 44,628
  • 11
  • 58
  • 63
0

You'll want to use the setExtent method.

tplaner
  • 8,363
  • 3
  • 31
  • 47
0

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

Maksym Gontar
  • 22,765
  • 10
  • 78
  • 114
  • I have used following approach: 1. defined actual height of title (like the way you described) 2. retrieved height of separator: new SeparatorField().getPreferredHeight() 3. But still I am losing somewhere one pixel. – Lyubomyr Dutko Nov 19 '09 at 15:18