我有一个可扩展的列表视图,当我添加其他自定义视图后,在一定数量的行之后包含列表视图。 问题是当第二次尝试扩展组时它会消失。
提前谢谢。 这是我在getChildView上编写的代码:
if(childPos == CurrGroup.MaxItems && CurrGroup.Competitors.size() > CurrGroup.MaxItems)
{
if(view == null)
{
view = inflater.inflate(R.layout.wizard_show_more_item, null, true);
TextView leauge_title = (TextView) view.findViewById(R.id.show_more_title);
leauge_title.setText(UiUtils.getTerm(context, "SCORES_GAME_SHOW_MORE"));
view.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
Intent TourAllCompetitorsIntent = new Intent(context, TournamentPromoAllCompetitors.class);
try
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos;
oos = new ObjectOutputStream(baos);
oos.writeObject(CurrGroup);
TourAllCompetitorsIntent.putExtra("Tournament", baos.toByteArray());
TourAllCompetitorsIntent.setAction(TournamentPromoAllCompetitors.ALL_COMPETITORS);
context.startActivity(TourAllCompetitorsIntent);
}
catch (IOException e) {}
}
});
}
}
else
{
ChildeItemView holder = new ChildeItemView();
if (view == null)
{
CompObj CurrCompetitor = getChild(groupPos, childPos);
view = inflater.inflate(R.layout.competition_promo_child_item, viewGroup, false);
holder.CompetitorIcon = (ImageView) view.findViewById(R.id.iv_competitor_icon);
holder.CompetitorText = (TextView) view.findViewById(R.id.tv_competitor);
holder.SelectedImage = (ImageView) view.findViewById(R.id.iv_selected);
holder.CompetitorID = CurrCompetitor.getID();
view.setTag(holder);
//view.setBackgroundResource(R.color.list_seperator);
//holder.CompetitorIcon.setImageResource(UiUtils.getSportTypeRes(getGroup(groupPos).sid , true));
holder.CompetitorText.setText(CurrCompetitor.getName());
String CurrCompetitorLogoPath = CompetitorsLogosPath + String.valueOf(getChild(groupPos, childPos).getID()) + "_70x70.png";
imageLoader.displayImage(CurrCompetitorLogoPath, holder.CompetitorIcon, options);
view.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
ChildeItemView ViewHelper = (ChildeItemView)v.getTag();
if(ViewHelper != null)
{
// If Already Selected
if(SelectedCompetitors.contains(ViewHelper.CompetitorID))
{
SelectedCompetitors.remove(ViewHelper.CompetitorID);
ViewHelper.SelectedImage.setImageResource(R.drawable.star_non_selected);
TournamentActivity.updateNumOfSelectedCompetitors();
}
else
{
SelectedCompetitors.add(ViewHelper.CompetitorID);
ViewHelper.SelectedImage.setImageResource(R.drawable.star_selected);
TournamentActivity.updateNumOfSelectedCompetitors();
}
}
}
});
}
else
{
holder = (ChildeItemView) view.getTag();
}
return view;