安卓:对话:我要隐藏或dimiss我要、dimiss

2023-09-07 14:07:32 作者:Mask(面具)

我与对话玩弄创建我的应用程序一些快速的意见(如登录时输入的名称等)

I'm playing around with Dialog to create some quick views in my app (like login enter name etc)

和我游荡什么是更好的:隐藏或关闭

and I'm wandering what is better: hide or dismiss.

我知道他们都做,但我一直在游荡,如果这是更好地只是藏在一个对话框,并再次显示它时,我需要或者撤销并重新创建它。

I know what they both do but I keep wandering if it is better to just hide a Dialog and show it again when I need or to dismiss it and recreate it.

我的对话框都很小,都在我的code实际上可以静态的,所以这样我不抱实例吨。

my Dialogs are small and are acutally static in my code so as such I don't hold tons of instances.

所以,有人可以给我用了隐藏解雇的利弊。

So can somebody give me the pros and cons of using hide over dismiss.

杰森

推荐答案

这取决于多少时间你的需要它,如果它是昂贵的创建它。如果不是创建它太贵了,我会亲自preFER将其关闭,有一个干净的环境。但是,如果你不使用数百个对话框,我不认为这真的很重要。

It depends on how many time your need it, and if it is expensive to create it. If it is not too expensive to create it, I would personally prefer to dismiss it, to have a "cleaner environment". But if you're not using hundreds of dialogs, I don't think this really matters.