2017-03-14 68 views

回答

1

這個,如果你想要更多的自定義選項

alertDialogue.setContentView(/*Layout*/) 

,或者如果你想要一些選擇使用此使用。

alertDialogue.setMultiChoiceItems(R.array.toppings, null, 
         new DialogInterface.OnMultiChoiceClickListener() { 
       @Override 
       public void onClick(DialogInterface dialog, int which, 
         boolean isChecked) { 
        if (isChecked) { 
         // If the user checked the item, add it to the selected items 
         mSelectedItems.add(which); 
        } else if (mSelectedItems.contains(which)) { 
         // Else, if the item is already in the array, remove it 
         mSelectedItems.remove(Integer.valueOf(which)); 
        } 
       } 
      }) 

檢查android guide

+0

感謝快速回復,我實際上必須使用onSingleChoiceItems,所以你可以告訴我這樣做的正確方法? –

+0

使用具有一個值的數組 –

+0

我現在試試 –

相關問題