温泉UI:在Android没有工作禁用设备后退按钮 [英] Onsen ui:Disable device backbutton in android didnt work
问题描述
我正在开发使用科尔多瓦和Onsenui一个Android应用程序,在whic我想禁用Android的后退按钮处理程序。
我试过<一个href=\"http://stackoverflow.com/questions/30211418/how-to-disable-android-back-button-handler-in-onsen-ui-phonegap\">this
答案,但我没有工作。
下面是我的code其放置在上面我的 app.js
文件
ons.ready(函数(){
ons.disableDeviceBackButtonHandler();});
假设你正在使用&LT; ONS-导航VAR =myNavigator&GT;&LT; / ONS-导航&GT;
,你已经尝试过这样的事情?
//要禁用导航后退按钮处理程序
myNavigator.getDeviceBackButtonHandler()禁用()。
您应该也不会忘记 cordova.js
引用添加到您的索引页。你并不需要粘贴文件,它会自动在每次部署科尔多瓦的应用程序时产生。
&LT;脚本SRC =cordova.js&GT;&LT; / SCRIPT&GT;
如果你不添加它,这将是不可能的操纵返回按钮行为
默认行为:
- 主页:关闭应用程序 。
- 其他网页:可追溯到
禁用处理程序,该应用程序会在您每次preSS按钮时关闭,而不管页面。
I am developing an android application using Cordova and Onsenui, in whic i want to disable the android back button handler. I've tried this answer ,but didnt work for me
Here is my code its placed on top of my app.js
file
ons.ready(function() {
ons.disableDeviceBackButtonHandler();
});
Supposing that you are using <ons-navigator var="myNavigator"></ons-navigator>
, have you already tried something like this?
// To disable a navigator back button handler
myNavigator.getDeviceBackButtonHandler().disable();
You should also not forget to add cordova.js
reference to your index page. You don't need to paste the file, it will be generated automatically every time you deploy a Cordova app.
<script src="cordova.js"></script>
If you don't add it, it will not be possible to manipulate the BackButton behavior.
Default behavior:
- Main page: closes the app.
- Other pages: goes back.
Disabling the handler, the app will be closed every time you press the button, regardless the page.
这篇关于温泉UI:在Android没有工作禁用设备后退按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!