1

有没有办法在不使用phonegap/cordova的情况下将android中的默认后退按钮事件映射到sencha touch?

4

1 回答 1

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 {
          }
      }
   }
于 2013-03-21T22:08:31.623 回答