Is there a way to get the width and height of an Options Menu
in DPI (or any other measurement)?

- 823
- 2
- 13
- 29
-
Why? Just curious, since I can't think of any use for that information. – Josh Jan 17 '12 at 15:01
-
2because i want control over my widgets – comp sci balla Jan 18 '12 at 19:08
3 Answers
As I understand - NO.
When you open option menu new Window
created - specially for showing menu. And from activity(and it's window) there is not way to get some information about another windows.
For controlling layout you can try to find layout of menu window, and check how many dp it is.(all standart android layouts is in folder sdk_folder/platforms/platform-x/data/res/layout) But this is not the best way - it will be platform-dependent, and if for example HTC provide there own option menus - you will have problems.

- 8,602
- 3
- 32
- 52
An android Menu object extends the View class, are the getHeight() en getWidth() methods not working?
In case they are working, but returning 0 every time, take a look at this question, where someone is encountering this problem when he wants to retrieve the width and height of a view.
-
The getHeight() and getWidth() methods are not acccessible for a Menu. Thanks though. – comp sci balla Jan 14 '12 at 17:39