Android:对话框:我应该隐藏还是关闭 [英] Android : Dialog: should I hide or dismiss
问题描述
我在玩Dialog来在我的应用中创建一些快速视图(例如登录,输入名称等)
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.
我的对话框很小,实际上在我的代码中是静态的,因此我没有很多实例.
my Dialogs are small and are actually 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.
推荐答案
这取决于您需要多少时间,以及创建它是否昂贵.如果创建它并不太昂贵,我个人更希望将其删除,以拥有一个更清洁的环境".但是,如果您不使用数百个对话框,那么我认为这并不重要.
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.
这篇关于Android:对话框:我应该隐藏还是关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!