public static int getStatusBarHeight(Context context) {
int result = 0;
int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android");
if (resourceId > 0) {
result = context.getResources().getDimensionPixelSize(resourceId);
}
return result;
}
还能获取些什么属性的值呢? 请看{sdk.home}\platforms\android-21\data\res\values\dimens.xml
<!-- Height of the status bar -->
<dimen name="status_bar_height">25dip</dimen>
<!-- Height of the bottom navigation / system bar. -->
<dimen name="navigation_bar_height">48dp</dimen>
<!-- Height of the bottom navigation bar in portrait; often the same as @dimen/navigation_bar_height -->
<dimen name="navigation_bar_height_landscape">48dp</dimen>
<!-- Width of the navigation bar when it is placed vertically on the screen -->
<dimen name="navigation_bar_width">42dp</dimen>
<!-- Height of notification icons in the status bar -->
<dimen name="status_bar_icon_size">24dip</dimen>
<!-- Size of the giant number (unread count) in the notifications -->
<dimen name="status_bar_content_number_size">48sp</dimen>
<!-- Margin at the edge of the screen to ignore touch events for in the windowshade. -->
<dimen name="status_bar_edge_ignore">5dp</dimen>
Reference:
http://mrtn.me/blog/2012/03/17/get-the-height-of-the-status-bar-in-android/
分享到:
相关推荐
React本机状态栏高度小型图书馆,可帮助您获取状态栏的高度聚苯乙烯 :mobile_phone: 支持X :red_heart:安装$ npm install --save react-native-status-bar-height# OR$ yarn add react-native-status-bar-height用法...
npm i react-native-statusbar-props 自动链接项目 react-native link react-native-statusbar-props 手动链接项目 安卓 settings.gradle include ":react-native-statusbar-props" project(":react-native-status...
主要介绍了Android有效获取状态栏(StatusBar)高度的方法,涉及Android针对状态栏(StatusBar)属性操作的相关技巧,需要的朋友可以参考下
android 平板的action bar、status bar、navigation bar的高度
主要特点隐藏/显示状态栏并确定动画更改状态栏样式以适合深色/浅色背景获取状态栏的高度,以便您可以使用它调整AIR布局在运行时收听大小更改。 例如,当用户正在使用电话并正在使用您的应用程序时。 从iPhoneX隐藏...
最近在做一个关于FAB的功能的时候需要获取状态栏的高度,在网上查了很多种方法,下面是选出的比较合理的两个方法。主要参考stackoverflow的这篇问答:...
//StatusBar高度 #define STATUSBAR_HEIGHT 20 //获取屏幕 宽度、高度 #define SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width) #define SCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height) //
2.获取状态栏(statusbar)的高度captureScreenSize.getStatusBarHeight(function(point){var barHeight = point[0];},function(){alert('error')});备注:在cordova-hybrid模式下,js获取不到屏幕的真实...
vivo-X21A: screenRealSize : 2280 , screenHeight : 2201, statusBar : 84, navigationBar : 126(Android9导航栏一键) vivo-X21A: screenRealSize : 2280 , screenHeight : 2075, statusBar : 84, navigationBar ...
window.statusbar.属性 功能:statusbar属性本身也是一个对象,用于访问它自已的visible属性从而确 定状态栏是否可见。 注:IE5.5浏览器不支持该属性。 3. statusbar.visible属性 语法格式: window.statusbar...
Android Compose样本存储库一个Android应用程序,提供Android Jetpack Compose的...SideMenuItem / StatusBar /屏幕状态不要忘了给存储库加注星标,并等待更多示例:D 讨论区请参阅问题部分: https : //github.com/
android-statusbar-library 状态栏库,兼容5.0版本以下,不需要设置主题样式即可修改状态栏颜色,使用起来很方便 API说明:CoreStatusBar类,主要是用与修改状态栏颜色,获取状态栏和导航栏高度 public static void ...
int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android"); if (resourceId > 0) { result = getResources().getDimensionPixelSize(resourceId); } return result; } 3,...
{ int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android"); try { return getResources().getDimensionPixelSize(resourceId); } catch (Resources....
没法下载,到这里折腾一把试试。 本文由abc2253130贡献 doc文档可能在WAP端浏览体验不佳。建议您优先选择TXT,或下载源文件到本机查看。 C#(WINFORM)学习 一、 C#基础 基础 类型和变量 类型和变量 类型 C# 支持两...
现又出现了error: collect2: ld returned 1 exit status 的错误,这说明程 序并没有结束,我们可以打开windows 任务管理器,可以看到我们的程序仍在执 行。 因为return a.exec();一句表示只要主窗口界面不退出,那么...
|------ 4.D 利用AppWizard创建并使用ToolBar StatusBar Dialog Bar |------ 4.E General Window |------ 4.F 关于WM_NOTIFY的使用方法 +-- 第五章 对话框 |------ 5.1 使用资源编辑器编辑对话框 |------ 5.2 创建有...