宽度和选项菜单的高度?宽度、选项、菜单、高度

2023-09-07 18:05:48 作者:何以﹌笙箫默

有没有办法得到一个的宽度和高度选项菜单在DPI(或其他测量)?

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

推荐答案

据我了解 - NO

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.

有关控制布局,你可以尝试找到菜单窗口的布局,并检查有多少DP它。(所有非标准Android的布局是在文件夹sdk_folder /平台/平台-X /数据/ RES /布局)但这不是最好的办法 - 这将是平台相关的,如果例如HTC提供他们自己的选择菜单 - 你将有问题。

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.