我有一个 listView,其中包含另一个 listView 的每个项目。我的问题是,对于每个 listView 每个项目,只显示一个项目。我不明白为什么?
这是我想要的和我拥有的:
在我的第一个 ListView 的适配器中,我为它的每个项目实现了一个 setAdapter:
@Override
public View getView(int position, View v, ViewGroup parent) {
final PlanningViewHolder viewHolder;
if (v == null) {
v = inflater.inflate(R.layout.item_list_planning, parent, false);
viewHolder = new PlanningViewHolder();
viewHolder.textViewPlanningMonth = (TextView) v.findViewById(R.id.textViewPlanningMonth);
viewHolder.textViewPlanningDayValue = (TextView) v.findViewById(R.id.textViewPlanningDayValue);
viewHolder.listViewPlanningContentForDay = (ListView) v.findViewById(R.id.listViewPlanningContentForDay);
v.setTag(viewHolder);
} else {
viewHolder = (PlanningViewHolder) v.getTag();
}
Planning planning = getItem(position);
viewHolder.textViewPlanningMonth.setText(planning.getMonth());
viewHolder.textViewPlanningDayValue.setText(planning.getDay());
viewHolder.listViewPlanningContentForDay.setAdapter(new PlanningContentAdapter(context, planning.getListContentPlanning()));
return v;
}