Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15338] Android orientationModes not working

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionCannot Reproduce
Resolution Date2014-09-12T11:44:46.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
Labelsandroid, orientation, orientationmodes, window
ReporterEzoom Agency
AssigneeIngo Muschenetz
Created2013-09-24T19:45:28.000+0000
Updated2017-03-21T21:41:54.000+0000

Description

Setting *"orientationModes = [Ti.UI.PORTRAIT];"* has no effect on android, as windows continue to change to other orientation Used to work on TI 2.x, not working anymore on TI 3.x
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');

// create tab group
var tabGroup = Titanium.UI.createTabGroup();

// create controls tab and root window
var win1 = Titanium.UI.createWindow({  
    title:'Tab 1',
    backgroundColor:'#fff',
    orientationModes: [Ti.UI.PORTRAIT],
});
win1.orientationModes = [Ti.UI.PORTRAIT];

var tab1 = Titanium.UI.createTab({  
    icon:'KS_nav_views.png',
    title:'Tab 1',
    window:win1
});

var label1 = Titanium.UI.createLabel({
	color:'#999',
	text:'I am Window 1',
	font:{fontSize:20,fontFamily:'Helvetica Neue'},
	textAlign:'center',
	width:'auto'
});

win1.add(label1);

// create controls tab and root window
var win2 = Titanium.UI.createWindow({  
    title:'Tab 2',
    backgroundColor:'#fff'
});
var tab2 = Titanium.UI.createTab({  
    icon:'KS_nav_ui.png',
    title:'Tab 2',
    window:win2
});

var label2 = Titanium.UI.createLabel({
	color:'#999',
	text:'I am Window 2',
	font:{fontSize:20,fontFamily:'Helvetica Neue'},
	textAlign:'center',
	width:'auto'
});

win2.add(label2);



//
//  add tabs
//
tabGroup.addTab(tab1);  
tabGroup.addTab(tab2);  


// open tab group
tabGroup.open();

Comments

  1. Ezoom Agency 2013-09-25

    Clean example:
       Titanium.UI.setBackgroundColor('#000');
       
       var win1 = Titanium.UI.createWindow({  
           title:'Tab 1',
           backgroundColor:'#fff',
           orientationModes: [Ti.UI.PORTRAIT], 
       });
       
       var label1 = Titanium.UI.createLabel({
       	color:'#999',
       	text:'I am Window 1',
       	font:{fontSize:20},
       	textAlign:'center',
       	width:'auto'
       });
       
       win1.add(label1);
       
       win1.open();
       
       
  2. Sunila 2013-12-15

    Tried with latest master, I couldn't reproduce the problem, it is working as expected.
  3. jithinpv 2014-09-12

    Cannot reproduce Titanium SDK version 3.4.0 master, 3.3.0.GA, 3.2.0.GA Titanium Studio, build: 3.3.0.201407100905 Titanium Command-Line Interface CLI version 3.3.0, Android device : Motorola Moto G, Android version : 4.4.4
  4. Lee Morris 2017-03-21

    Closing ticket as the issue cannot be reproduced and due to the above comments.

JSON Source