ExpandableListView
とカスタムアダプターのバグに直面しています TextView
は自分の値ではなく、ビデオで見ることができます。モデルはこのリスト内でのみこの値を変更しません。CustomAdapterディスプレイのアーティファクトを含むExpandableListView
名前と電話機は影響を受けませんが、2つの右テキストビューがあります。
https://www.youtube.com/embed/YjC_QsA75yo
誰かがこのバグを満たしていますか? それをトレースして修正する方法はありますか?
UPD
public ExpandableAdapter(List<CategoryModel> categoryModels, Context ctx) {
this.categoryModels = categoryModels;
this.ctx = ctx;
}
@Override
public int getGroupCount() {
return categoryModels.size();
}
@Override
public int getChildrenCount(int groupPosition) {
return categoryModels.get(groupPosition).getMembers().size();
}
@Override
public Object getGroup(int groupPosition) {
return categoryModels.get(groupPosition);
}
@Override
public Object getChild(int groupPosition, int childPosition) {
return categoryModels.get(groupPosition).getMembers().get(childPosition);
}
@Override
public long getGroupId(int groupPosition) {
return categoryModels.get(groupPosition).getId();
}
@Override
public long getChildId(int groupPosition, int childPosition) {
return categoryModels.get(groupPosition).getMembers().get(childPosition).getId();
}
@Override
public boolean hasStableIds() {
return true;
}
@Override
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
View v = convertView;
if (v == null) {
LayoutInflater inflater = (LayoutInflater) ctx.getSystemService
(Context.LAYOUT_INFLATER_SERVICE);
v = inflater.inflate(R.layout.reg_group_layout, parent, false);
}
TextView groupName = (TextView) v.findViewById(R.id.tv_group_name);
TextView groupCount = (TextView) v.findViewById(R.id.tv_group_count);
CategoryModel cat = categoryModels.get(groupPosition);
groupName.setText(cat.toString());
groupCount.setText(cat.getMembers().size() + "");
return v;
}
@Override
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
View v = convertView;
if (v == null) {
LayoutInflater inflater = (LayoutInflater) ctx.getSystemService
(Context.LAYOUT_INFLATER_SERVICE);
v = inflater.inflate(R.layout.reg_member_layout, parent, false);
}
TextView tvName = (TextView) v.findViewById(R.id.tv_reg_mem_name);
TextView tvPhone = (TextView) v.findViewById(R.id.tv_reg_mem_phone);
TextView tvFinishTime = (TextView) v.findViewById(R.id.tv_reg_finishtime);
TextView tvPenaltyTime = (TextView) v.findViewById(R.id.tv_reg_penaltytime);
MemberModel mem = (MemberModel) getChild(groupPosition, childPosition);
if (!mem.getActive()) {
tvName.setTextColor(Color.GRAY);
tvPhone.setTextColor(Color.GRAY);
} else {
tvName.setTextColor(Color.BLACK);
tvPhone.setTextColor(Color.BLACK);
}
tvName.setText(mem.getMem_name());
tvPhone.setText(mem.getMem_tel());
Util.setFinishTime(tvFinishTime, mem.getFinishTime());
Long penTime = mem.getPenaltyTime();
if (penTime != null && penTime != 0) {
Util.setPenaltyTime(tvPenaltyTime, penTime);
} else {
//tvPenaltyTime.setVisibility(View.INVISIBLE);
}
return v;
}
@Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
return true;
}
@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
return true;
}
@Override
public void registerDataSetObserver(DataSetObserver observer) {
super.registerDataSetObserver(observer);
}
共有コードを試みたように見えるよう、
をか.................. –
[link](https://www.youtube.com/watch?v=YjC_QsA75yo)ビデオへのリンク – user2756073