I’m struggling with the BrowserField. I would like a screen with a BrowserField at the top, and one at the bottom. I would like to point each one to a URL containing an image (and maybe HTML) – kind of how one might see an AdMob advert.
So I want to define a custom size for the BrowserField. Can that be done?
- At the moment, the
BrowserFieldis taking up the whole screen. (* see update below) - I have tried to subclass it anonymously – but it is final.
Is this a possible use case, or should I look for a different solution to the problem altogether…?
Update:
I have placed the BrowserField within a VerticalFieldManager and sized that accordingly (as per Blackberry BrowserField does not fit to screen).
(re-edit: this was the right idea, but I had made a mistake in my code that made me think it was still broken. Accepted answer below provides perfect code to accomplish exactly what I was hoping for.)
I’ve layouted two BrowserFields. One is aligned to top, the other is aligned to bottom. Their height is defined by
TOP_BROWSER_FIELD_HEIGHTandBOTTOM_BROWSER_FIELD_HEIGHTaccordingly. In the middle there is another manager that consume all the available height that is left after layouting the BrowserFields.The result is
