protected void populateView() {

    TextView textView = (TextView) getView().findViewById(R.id.standings_title);
    textView.setText(getActivity().getString(R.string.league_title, userTeam.getSeriesName()));

    View teamView;
    int realPosition = 0;
    int leagueSize = league.size();
    List<LeagueTeam> standingsLeague;
    if (mainActivity) {
      standingsLeague = new ArrayList<LeagueTeam>();
      realPosition = shrinkLeague(standingsLeague);
      getView().findViewById(R.id.standings_titles).setVisibility(View.GONE);
    } else {
      standingsLeague = league;
      getView().findViewById(R.id.standings_titles).setVisibility(View.VISIBLE);
    }
    ViewGroup standings = (ViewGroup) getView().findViewById(R.id.standings_table);
    int position = 1;
    int max = standings.getChildCount();
    for (LeagueTeam team : standingsLeague) {
      if ((position) < max) {
        // En ese caso la tabla tiene elementos y el de esta posición
        // puede modificarse
        teamView = standings.getChildAt(position);
      } else {
        teamView = inflater.inflate(R.layout.standings_fragment_team, null);
        standings.addView(teamView);
      }
      teamView.setTag(team);
      textView = (TextView) teamView.findViewById(R.id.team_position);
      textView.setText(Integer.toString(realPosition + 1));
      int color = colorPosition(realPosition, leagueSize);
      if (color > 0) {
        textView.setBackgroundColor(getResources().getColor(color));
      }

      textView = (TextView) teamView.findViewById(R.id.team_name);
      textView.setText(team.getTeamName());
      if (team.getTeamId() == userTeam.getTeamId()) {
        textView.setTypeface(Typeface.DEFAULT_BOLD);
      } else {
        textView.setTypeface(Typeface.DEFAULT);
      }

      ((TextView) teamView.findViewById(R.id.team_points))
          .setText(Integer.toString(team.getPoints()));
      position++;
      realPosition++;
    }
    if ((position) < max) {
      // Aún quedan elementos que no deberían estar aquí
      for (int i = position; i < max; i++) {
        standings.removeViewAt(position);
      }
    }
  }
 private int shrinkLeague(List<LeagueTeam> standingsLeague) {
   int position = 0;
   int playerTeamPos = league.size();
   for (LeagueTeam team : league) {
     standingsLeague.add(team);
     if (team.getTeamId() == userTeam.getTeamId()) {
       playerTeamPos = position;
     } else if ((playerTeamPos + NUM_TEAMS_AFTER) == position) {
       break;
     }
     position++;
   }
   position = 0;
   if (playerTeamPos > NUM_TEAMS_BEFORE) {
     position = playerTeamPos - NUM_TEAMS_BEFORE;
     for (int i = 0; i < playerTeamPos - NUM_TEAMS_BEFORE; i++) {
       standingsLeague.remove(0);
     }
   }
   return position;
 }