我想知道如何使用setonItemclick監聽器方法來獲取可展開列表視圖的子值。 我的代碼如下,但點擊事件工作不正常。如何在android中獲取可擴展列表視圖的子值?
mExpandableListView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View v, int groupPosition,
long id) {
// TODO Auto-generated method stub
int itemType = ExpandableListView.getPackedPositionType(groupPosition);
Log.i("item type",""+itemType);
if (itemType == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
childPosition = ExpandableListView.getPackedPositionChild(id);
groupPosition = ExpandableListView.getPackedPositionGroup(id);
Log.i("child",""+ childPosition);
Log.i("child Group",""+ groupPosition);
} else if(itemType == ExpandableListView.PACKED_POSITION_TYPE_GROUP) {
groupPosition = ExpandableListView.getPackedPositionGroup(id);
Log.i("Group",""+ groupPosition);
}
}
});
這種方法也不能properlly..please工作給你想用exp清單,這個例子 – ckpatel 2012-07-16 10:55:45
我想要得到的子ID以及組ID .. – 2012-07-16 10:58:01
要獲取的記錄完整的例子 – ckpatel 2012-07-16 10:59:17