有没有办法将android中的默认后退按钮事件映射到sencha touch而不使用phonegap / cordova ???
答案 0 :(得分:1)
可能是这样,有帮助:
if (Ext.os.is('Android')) {
document.addEventListener("backbutton", Ext.bind(onBackKeyDown, this), false); // add back button listener
function onBackKeyDown(e) {
e.preventDefault();
// You are at the home screen
if (Ext.Viewport.getActiveItem().xtype == selectedHomePage.xtype ){
Ext.Msg.confirm(
"",
Are You sure, exit?,
function(buttonId) {
if(buttonId === 'yes') {
navigator.app.exitApp();
}
}, this);
} else {
}
}
}