我想創建一個顯示對話框的簡單活動。 我在清單:如何在退出Theme.Dialog後不顯示父活動
android:theme="@android:style/Theme.Dialog
,並在活動的onCreate()方法:
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.activity_dialog, (ViewGroup) findViewById(R.id.layout), false);
AlertDialog.Builder builder = new AlertDialog.Builder(this)
.setView(layout);
AlertDialog alertDialog = builder.create();
alertDialog.show();
當我啓動應用程序,它會顯示正確的對話框,但是當我按後退按鈕關鍵,它爲我父活動作爲圖像中
我想實現的是隻顯示對話框,磨片用戶退出對話框後,應用程序退出。之後我不想在中間看到這個令人厭惡的彈出窗口。 我該怎麼做?
謝謝!
你是絕對正確的!在活動中誇大佈局並沒有任何意義,並在manifest xD中設置Theme.Dialog。多謝,夥計 – santidoo