Skip to content

Instantly share code, notes, and snippets.

@MotiurRahman
Created June 21, 2019 12:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MotiurRahman/f0d92ad2c0861150fb30bc639268ee39 to your computer and use it in GitHub Desktop.
Save MotiurRahman/f0d92ad2c0861150fb30bc639268ee39 to your computer and use it in GitHub Desktop.
How to calculate the height of the status bar.
var win = Ti.UI.createWindow({
title : "title",
backgroundColor : '#fff'
});
var Activity = require('android.app.Activity');
activity = new Activity(Ti.Android.currentActivity);
// status bar height
var statusBarHeight = 0;
var resourceId = activity.getResources().getIdentifier("status_bar_height", "dimen", "android");
if (resourceId > 0) {
statusBarHeight = activity.getResources().getDimensionPixelSize(resourceId);
}
Ti.API.info("statusBarHeight:" + statusBarHeight);
win.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment