Skip to content

Instantly share code, notes, and snippets.

@csemrm
Created December 3, 2013 11:54
Show Gist options
  • Save csemrm/7767948 to your computer and use it in GitHub Desktop.
Save csemrm/7767948 to your computer and use it in GitHub Desktop.
Lock window screen in Portrait Android For Android Window screen lock, we need to set orientationModes and orientation property in the window object. we also need to make sure you force a heavyweight window by either setting fullscreen: true or navBarHidden: true.
var win = Titanium.UI.createWindow({
title : 'My app',
backgroundColor : '#fff',
navBarHidden : true,
orientationModes : [Titanium.UI.PORTRAIT]
});
Titanium.UI.orientation = Titanium.UI.PORTRAIT;
var testButton = Ti.UI.createButton({
title : 'Test Button',
});
testButton.addEventListener('click', function() {
alert('\'Test Button\' was clicked!');
});
win.add(testButton);
win.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment