10-16-2012 03:03 PM
Hello all,
I'm extending Field to create my customfield which is intenteded to show an image using all the screen available space. With that i mean that i'm looking to get my field use all available height and width, so if i have a title bar, it should use the screen height minus the title bar.
The problem is i don't know how to exactly accomplish that. I guess it has something to do with setextent and layout, but i don't know if there is some way the get the available screen height and width on the field itself or i have to pass them from the manager (which would not be my preferred solution).
Thanks!
10-16-2012 06:02 PM
You can use Display.getHeight() and Display.getWidth() to determine the amount of available real estate on the screen.
You'll then want to override getPreferredHeight() and getPreferredWidth() in your Field implementation.
10-16-2012 06:31 PM
But if i'm not mistaken Display.getHeight() and Display.getWidth() return the total size of the screen and not the available one. So if i have a title bar of 30px height and i call Display.getHeight() on a 360px height screen, Display.getHeight() will not return 330px, will return 360px, so my field will be bigger than available space on the screen. I am right or Display.getHeight() will return a different size inside a field?
Any other ideas?
Thanks
10-16-2012 07:53 PM
Hi @guillemmat
Try the following:
1. Let your field extend Vertical Field Manager.
2. Pass USE_ALL_WIDTH & USE_ALL_HEIGHT in the call to the super in the constructor.
3. Set the image as a background:
setBackground(BackgroundFactory.createBitmapBackgr
Hope that helps,
E.