getMenuButtonBoundingClientRect
同步向游戏返回宿主右上角胶囊按钮的位置和尺寸。坐标原点为游戏 View 的左上角,坐标和尺寸的单位均为物理像素(px)。
方法声明
java
MenuButtonBoundingClientRect getMenuButtonBoundingClientRect();MenuButtonBoundingClientRect
global.sud.op.runtime.client.model.MenuButtonBoundingClientRect
| 字段 | 类型 | 说明 |
|---|---|---|
width | int | 宽度,单位 px |
height | int | 高度,单位 px |
top | int | 上边界,单位 px |
right | int | 右边界,单位 px |
bottom | int | 下边界,单位 px |
left | int | 左边界,单位 px |
布局完成后,取胶囊相对游戏 View 的边界。若用 getLocationOnScreen() 测量两个 View,则胶囊的左右边界各减去游戏 View 的 x 坐标,上下边界各减去游戏 View 的 y 坐标,宽高取胶囊的实测值。
例如,胶囊的屏幕边界 (left, top, right, bottom) 为 (774, 120, 1032, 216),游戏 View 的屏幕原点为 (24, 60),则返回 (750, 60, 1008, 156),宽高为 258 × 96 px。
