@Manuel_Rodrigues 我们只需要在“新窗口”中添加一些属性就可以做到这一点(这里是例子):
1.win.js
var win = Ti.UI.createWindow({
width: '100%',
height: '100%',
backgroundColor: 'white'
});
//sliding animation
var slide_to_right = Ti.UI.createAnimation({
left: 0,
duration: 200
});
//win swipe listener
win.addEventListener('click',function(e){
if(e.direction == 'right'){ //swipe to right open the menuWindow
//Alloy
var menu_win = Alloy.createController('menu_window').getView();
menu_win.setLeft('-100%'); //menuWindow will open with a sliding animation from left
menu_win.open(slide_to_right);
/*
//not Alloy
var menuWin = require('/menu_window'); //path of menu_window.js
var menuWindow = new menuWin();
menuWindow.open(slide_to_right);
*/
}
});
win.open();
2.menu_window.js
//Alloy
var menuWindow = Ti.UI.createWindow({
width: '40%',
height: '100%',
backgroundColor: 'transparent',
theme: 'Theme.AppCompat.Translucent.NoTitleBar' //backgroundColor set 'transparent' make the menuWindow seems suspend above the win-window, the 'theme' property just remove the window default tile navigation-bar in android
});
menuWindow.open();
/*
//not Alloy
function menuWin(){
var menuWindow = Ti.UI.createWindow({
width: '40%',
height: '100%',
backgroundColor: 'transparent',
theme: 'Theme.AppCompat.Translucent.NoTitleBar'
});
return menuWindow;
}
module.exports = menuWin;
*/
因此,完成您想要的事情的关键是将 backgroundColor 和 theme 属性设置为新的另外,定义一个打开动画来改变窗口打开的system-default-animation。但是,我不建议您使用这种方式,因为不需要将 menu(您希望在基本窗口中显示的)定义为窗口 UI 组件,您只需将菜单定义为view 会在您执行滑动操作后显示。我认为这对你也有用,而且效果更好。
希望这些对您有所帮助!祝你好运!