statusBar

概述

statusBar 为了更好的兼容沉浸式状态栏,所以提供用户根据状态栏的高度来距离上面多少来显示内容,避免距离状态栏高度不准确情况发生。

getStatusBarHeight

获取当前设备的状态栏高度

getStatusBarHeight(callback(ret, err))

callback(ret, err)

ret:

  • 类型:JSON对象
  • 内部字段:
{
    statusHeight: 0      //int型;0,当前设备的状态栏高度
}

示例代码

var statusBar = api.require('statusBar');

//异步返回结果:
statusBar.getStatusBarHeight(function(ret, err){
    alert(ret.statusHeight);
});

//同步返回结果:
var statusBarHeight  = statusBar.getStatusBarHeight();
alert(statusBarHeight);

可用性

Android系统

可提供的1.0.0及更高版本

是否仍需要帮助? 请保持联络!
最后更新于 2024/04/24