2011-07-06 67 views

回答

0

OK,這似乎是最好的解決辦法是用列表項點擊/長按聽衆來做到這一點。

public void onClick(View view) 
{ 
    // click - do something with item  
} 

public boolean onLongClick(View view) 
{ 
    // group position was stored in view tag 
    int groupPosition = (Integer) view.getTag(); 

    ExpandableListView listView = (ExpandableListView) findViewById(R.id.expandableListView); 
    if (listView.isGroupExpanded(groupPosition)) 
     listView.collapseGroup(groupPosition); 
    else 
     listView.expandGroup(groupPosition); 

    return true; 
} 
+0

是這些setOnItemClickListeners ???? – Maxrunner

+0

我想(如果我沒記錯的話),這些是添加到列表中的項目上的點擊偵聽器(每個都有一個鏈接回組的標籤) – Drejc