0
我目前正在研究下面的代碼,下面的代碼是鈦導航組中的ios導航組。我試圖讓它或者既有ios又有android,但看起來很複雜。我怎樣才能使它爲iOS和Android。titanium導航組爲ios和android
var win1 = Titanium.UI.createWindow();
var win2 = Titanium.UI.createWindow({
backgroundColor: 'white',
barColor: '#336699'
});
var win3 = Titanium.UI.createWindow({
backgroundColor: 'white',
barColor: '#336699',
title: 'Register'
});
var win4 = Titanium.UI.createWindow({
backgroundColor: 'white',
barColor: '#336699',
title: 'Sign in'
});
//create view1
var view1 = Titanium.UI.createView();
//create label1
var label1 = Titanium.UI.createLabel({
text: 'Welcome',
height: 40,
width: 250,
top: 100,
color: '#336699'
});
//create button1
var button1 = Titanium.UI.createButton({
title: 'Register',
height: 35,
width: 100,
top: 210
});
button1.addEventListener('click', function(){
nav.open(win3);
});
var nav = Titanium.UI.iPhone.createNavigationGroup({
window: win2
});
//create view2
var view2 = Titanium.UI.createView();
//create label2
var label2 = Titanium.UI.createLabel({
height: 45,
width: 200,
top: 145,
color: '#336699'
});
//create button2
var button2 = Titanium.UI.createButton({
title: 'Sign in',
height: 35,
width: 100,
top: 250
});
button2.addEventListener('click', function(){
nav.open(win4, {animated:true});
});
var nav = Titanium.UI.iPhone.createNavigationGroup({
window: win2
});
view2.add(button1);
view1.add(label1);
win2.add(view1);
view2.add(button2);
view2.add(label2);
win2.add(view2);
win1.add(nav);
win1.open();
http://stackoverflow.com/questions/12530946/navigationgroup-android-in-titanium –