Android避免对话框在设备旋转后关闭的最佳方式 [英] Android Best way of avoid Dialogs to dismiss after a device rotation
问题描述
android:configChanges =keyboardHidden | orientation
或覆盖以下方法,这似乎是最推荐的:
protected对话框onCreateDialog(int id)
但是,在浏览Android参考文档后,我可以注意到这些Dialog方法已被弃用。
所以,显而易见的问题是:
今天,在设备旋转后避免对话框关闭的最佳方法是什么? >
提前感谢
来自新Fragments API的href =http://developer.android.com/reference/android/app/DialogFragment.html> DialogFragment 。要在3.0以上的平台上使用它,请使用兼容性包。
After a long search around this forum, I found a lot of answers where people propose using solutions for avoiding dialogs to dismiss after rotation, just like:
android:configChanges="keyboardHidden|orientation"
Or override the following method, which appeared to be the most recommended:
protected Dialog onCreateDialog(int id)
But, after look around the Android Reference Documentation, I could notice that these Dialog methods are being deprecated.
So, the obvious question is:
Today, what is the best way of avoid Dialogs to dismiss after a device rotation?
Thanks in advance.
You should now use DialogFragment from new Fragments API. To use it on the platform lower, than 3.0, use compatibility package.
这篇关于Android避免对话框在设备旋转后关闭的最佳方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!