簡體   English   中英

Android-警報對話框不顯示項目

[英]Android - Alert dialog doesn't show items

您能解釋一下為什么該對話框不顯示項目嗎?

new AlertDialog.Builder(MainActivity.context)
                        .setTitle("Gestione topic")
                        .setMessage("Cosa vuoi leggere?")
                        .setItems(R.array.topicChoices, new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialogInterface, int i) {
                                //code here
                            }
                        }).setNegativeButton("Annulla", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        dialogInterface.dismiss();
                    }
                }).show();

R.array.topicChoices

<string-array name="topicChoices">
    <item>Topic non letti</item>
    <item>Risposte non lette</item>
</string-array>

錯誤在哪里?

多謝你們。

setMessage會覆蓋setItem,因此您必須刪除setMessage。

由於上述原因,在此處不顯示警告對話框的地方,請參閱此處

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM