后退按钮使用 appcelerator 钛退出 android 中的应用程序 [英] Back button exits application in android using appcelerator titanium

查看:28
本文介绍了后退按钮使用 appcelerator 钛退出 android 中的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Titanium Development 的新手.在原生 android 中,如果我们按下后退按钮,则只会关闭当前活动,它将返回到上一个活动,但是当我使用 Titanium 在 Android 中按下后退按钮时,它会退出应用程序.

I am new to Titanium Development. In Native android if we press back button only current activity will be closed and it will go back to the previous activity but when I press the back button in Android using Titanium it exits from the application.

我该如何改变这种行为?

How can I change this behaviour?

推荐答案

有两种类型的窗口,例如,轻量级和重量级.如果您在 Titanium android 中创建一个轻量级窗口而不是按后退按钮,它将存在于您的应用程序中.

There are two types of windows like, lightweight and heavyweight. If you create a lightweight window in Titanium android than on back button press it will exist from your application.

您可以通过创建重量级窗口来实现您想要的.您可以通过将其作为模式窗口打开来在钛中创建重量级窗口.所以在新建窗口的时候把参数modal:true新窗口将创建为模态窗口(钛 android 的重量级窗口).然后,如果您按下后退按钮,它将不会退出应用程序.

You can achieve what you want by creating heavyweight window. You can create heavyweight window in titanium by open it as modal window. So put the parameter modal:true when you create a new window. New window will be created as modal window (heavyweight window for titanium android). And then after if you will press back button it will not exit from application.

这篇关于后退按钮使用 appcelerator 钛退出 android 中的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆