我有一个自定义视图。我正在尝试添加多个数组值。但它只是打印最后一个。例如检查下面的代码。我正在尝试显示 schedulePeriod.scheduleMatchups.get(i)。它有两个值。(获取(0)和获取(1)。它总是获取get(1)的值而不是get(0)。scheduleView.add(返回一个值而不是两者)有人可以帮助我吗?
谢谢你
private ArrayList<View> getScheduleView(final SchedulePeriod schedulePeriod) {
String teamid = FantasyFootballApplication.getFantasyTeam().teamId;
View scheduleView = playerRankingsInflate(R.layout.schedule_view);
ArrayList<View> scheduleViews = new ArrayList<View>();
for(int i=0; i<schedulePeriod.scheduleMatchups.size(); i++){
if(!(schedulePeriod.scheduleMatchups.isEmpty())) {
TextView weekNumber = (TextView) scheduleView.findViewById(R.id.week_number);
weekNumber.setText(schedulePeriod.scheduleId);
if(!(teamid.equals(schedulePeriod.scheduleMatchups.get((i)).scheduleAwayTeam.awayTeamId))) {
TextView scheduleOpp = (TextView) scheduleView.findViewById(R.id.schedule_opp);
scheduleOpp.setText(schedulePeriod.scheduleMatchups.get(i).scheduleAwayTeam.awayTeamShortName);
TextView scheduleName = (TextView) scheduleView.findViewById(R.id.schedule_teamname);
scheduleName.setText(schedulePeriod.scheduleMatchups.get(i).scheduleAwayTeam.awayTeamName);
} else if(!(teamid.equals(schedulePeriod.scheduleMatchups.get((i)).scheduleHomeTeam.homeTeamId))) {
TextView scheduleOpp = (TextView) scheduleView.findViewById(R.id.schedule_opp);
scheduleOpp.setText(schedulePeriod.scheduleMatchups.get(i).scheduleHomeTeam.homeTeamShortName);
TextView scheduleName = (TextView) scheduleView.findViewById(R.id.schedule_teamname);
scheduleName.setText(schedulePeriod.scheduleMatchups.get(i).scheduleHomeTeam.homeTeamName);
}
}
scheduleViews.add(scheduleView);
}
return scheduleViews;
}