問題描述
還有什么需要調用的嗎?
Is there something else that should be called?
showDialog(TIME_DIALOG_ID);
它在 本教程中,但在 deprecated日食.
It's in this tutorial but says deprecated in Eclipse.
推薦答案
來自 http://developer.android.com/reference/android/app/Activity.html
public final void showDialog (int id) 在 API 級別 1 中添加
public final void showDialog (int id) Added in API level 1
此方法在 API 級別 13 中已棄用.使用新的 DialogFragment改為使用 FragmentManager 類;這也適用于較舊的平臺通過 Android 兼容包.
This method was deprecated in API level 13. Use the new DialogFragment class with FragmentManager instead; this is also available on older platforms through the Android compatibility package.
showDialog(int, Bundle) 的簡單版本,不需要任何論據.只需使用 null 參數調用 showDialog(int, Bundle).
Simple version of showDialog(int, Bundle) that does not take any arguments. Simply calls showDialog(int, Bundle) with null arguments.
為什么
- 顯示對話窗口的片段,浮動在其活動窗口的頂部.該片段包含一個 Dialog 對象,它會根據片段的狀態適當地顯示該對象.對話框的控制(決定何時顯示、隱藏、關閉)應通過此處的 API 完成,而不是直接調用對話框.
- 這是一個很好的討論Android DialogFragment vs Dialog
- 另一個很好的討論DialogFragment 相對于 AlertDialog 的優勢
如何解決?
- http://android-developers.blogspot.in/2012/05/using-dialogfragments.html
更多
- http://developer.android.com/guide/topics/fundamentals/片段.html
- http://developer.android.com/training/basics/fragments/index.html
這篇關于不推薦使用 showDialog.有什么選擇?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!