Is there a way to get the width and height of an Options Menu
in DPI (or any other measurement)?
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With