views:

399

answers:

3

Hi,

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

A: 

You'll want to use the setExtent method.

evolve
well, still I see separator. And it's height difficult to define.
Lyubomyr Dutko
A: 

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

Max Gontar
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
+1  A: 

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
Thanks for advice. But I am getting another interesting issues. If I do later screen layout change (like deleting some fields and adding new ones), the Theme looks like is returning back.
Lyubomyr Dutko
Hmm, I've never seen that happen before
Marc Novakowski