これは、子要素の onclick リスナーです。
getExpandableListView().setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
// TODO Auto-generated method stub
onChild_Click(parent,v,
groupPosition,childPosition, id);
return true;
}
});
子要素をクリックすると機能します。ここで、最初の子をデフォルトとして選択する必要があります( onCreate() メソッド内)。グループを拡大するために、私はこれを使用しています。
getExpandableListView().expandGroup(0);
私は子要素に対してこれらのことを試しましたが、onclickイベントを発生させていません.しかし、子をクリックすると機能しています.
getExpandableListView().setItemChecked(1, true);
と
getExpandableListView().setSelectedChild(0, 0, true);