WHen you are designing something, you have to start with a layout.
the screen will usually contain:
[ title bar ]
|----------------------------------|
| |
| layout/activity |
| |
|----------------------------------|
[ menu bar ]
I removed the titlebar, but trying to account for the menu bar to get the width and height of a layout or activity.
My thing is that since i do it onCreate, dimensions arent figured out yet. When the program is running, i can use the layout.getWidth(). How would i get the dimensions of my applicable workspace? If i get the screen dimensions, it is the full screen, where i dont want that…. as the menu bar is counted.
THis is for a tablet, and i cant just remove the menubar. Do any of you know?
when you have a View, you can use View.post() which will run it like a thread (hense why it is called runnable). The perk of this is that when you implement this in the root layout, it will post the contents to the screen. This, then allowing you to get the asset being looked for, screen dimensions.
The reason why you arent getting the screen dimensions is based on the lifecycle of your program. onCreate does not have anything rendered on screen, so there is no way of knowing the dimensions of the contents by that point in the run.
Example Code in onCreate():