正しいgroupcursorsとchildcursorsでSimpleCursorTreeAdapter
作成するために使用できます。ExpandableListView
私のプログラムでは、各子に3つTextView
のが含まれています。グループを展開して子をクリックすると、カスタムダイアログを使用して3つの値がEditText
表示されます。
一度に「1つ」のグループだけを開くと、プログラムは問題ありません。クリックすると正しい子の値を取得できます。しかし、同時に複数のグループを展開するとします。最新のグループの下にある最新の子のみが表示されます。
例:グループAには3つのアイテム、グループBには5つのアイテム、グループCには2つのアイテムがあります。最初にグループAの子をクリックしましたが、問題ありません。次にグループBの子をクリックしました。問題ありませんが、グループAの子をクリックすると、グループBの子が表示されます。正しい表示方法がわかりません。子供。Toastを使用して表示すると、すべての子が正しいので、奇妙です。この方法で何ができますか?
epView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener()
{
@Override
public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long row)
{
return false;
}
});
epView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id)
{
int tempid = childcursor.getInt(0);
String temp1 = childcursor.getString(1);
String temp2 = childcursor.getString(2);
String temp3 = childcursor.getString(3);
CustomDialog custom = new CustomDialog(ListCateActivity.this,catecursor,childcursor,temp1,temp2,temp3,tempid);
custom.setTitle("Record Information");
custom.show();
Toast.makeText(ListCateActivity.this, "Group:"+String.valueOf(groupPosition).toString()+" Child: "+String.valueOf(childPosition).toString()+temp1+" "+temp2+" "+temp3, Toast.LENGTH_SHORT).show();
return true;
}
});
ありがとう !!