[英]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.