2012-02-24 104 views
2

我使用下面的代碼創建一個警告對話框,並插入裏面在警告對話框

現在我想使這個項目不可見或刪除對話框內的列表項無形使列表項,是一個辦法做到它

AlertDialog.Builder builder = new AlertDialog.Builder(this); 
LayoutInflater factory = LayoutInflater.from(this); 
final View directionEntryView = factory.inflate(R.layout.contact_dialog, null);     

title.setText(contactStore.getContactName()); 
builder.setTitle(contactStore.getContactName()); 

/** Once I fill the item list , i want to make it invisible **/ 
builder.setItems(R.array.select_dialog_items, null); 

項目列表如下

<?xml version="1.0" encoding="utf-8"?> 
<resources> 
    <string-array name="select_dialog_items" > 
     <item>Command one</item> 
     <item>Command two</item> 
     <item>Command three</item> 
     <item>Command four</item> 
    </string-array> 
</resources> 
+0

你想隱藏*一個*的項目? – dacwe 2012-02-24 14:35:25

+0

不,整個列表,但我只能在數組中只放一個項目,所以最終它將隱藏整個列表我猜 – Hunt 2012-02-24 14:38:26

回答

0

使用這樣的:title.setVisibility(View.GONE);

+0

我試過你的代碼,但它什麼也沒做,我猜title.setVisibility(View.GONE )可能隱藏標題而不是警報對話框中的列表項目 – Hunt 2012-02-24 14:48:28