2016-11-28 36 views

回答

1

您可以創建一個自定義警告對話框這種方式:

AlertDialog.Builder adb = new AlertDialog.Builder(this); 
    adb.setTitle("Custom dialog"); 
    view = (LinearLayout) getLayoutInflater() 
//custom layout for you dialog 
     .inflate(R.layout.dialog, null); 
    adb.setView(view); 
0

說實話,如果你的情況讓你修改了一下對話框我會嘗試使用最新的應用程序兼容性,提供了材料查找對話框。

從這個庫中使用AlertDialog的優勢在於,如果有或沒有可用的按鈕寬度顯示,它將執行「完整堆棧」按鈕。

下面是它會是什麼樣子在空間不夠的情況下:

enter image description here

https://material.google.com/components/dialogs.html#dialogs-specs