是否可以捕获Android设备后退按钮的按住事件以关闭应用程序?
干杯
保罗
解决方法:
是的,请参阅PhoneGap API:
http://docs.phonegap.com/en/1.0.0/phonegap_events_events.md.html
// Call onDeviceReady when PhoneGap is loaded.//// At this point, the document has loaded but phonegap.Js has not.// When PhoneGap is loaded and talking with the native device,// it will call the event `deviceready`.// document.addEventListener("deviceready", onDeviceReady, false);// PhoneGap is loaded and it is Now safe to make calls PhoneGap methods//function onDeviceReady() { // Register the event Listener document.addEventListener("backbutton", onBackKeyDown, false);}// Handle the back button//function onBackKeyDown() {}
总结 以上是内存溢出为你收集整理的Phonegap – Android Back按钮 – 如何捕捉按住事件全部内容,希望文章能够帮你解决Phonegap – Android Back按钮 – 如何捕捉按住事件所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)