@Override
  public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder vh;
    if (convertView == null) {
      vh = new ViewHolder();
      convertView = View.inflate(context, R.layout.route_segment, null);
      vh.parent = (RelativeLayout) convertView.findViewById(R.id.bus_item);
      vh.busLineName = (TextView) convertView.findViewById(R.id.bus_line_name);
      vh.busDirIcon = (ImageView) convertView.findViewById(R.id.bus_dir_icon);
      vh.busStationNum = (TextView) convertView.findViewById(R.id.bus_station_num);
      vh.busExpandImage = (ImageView) convertView.findViewById(R.id.bus_expand_image);
      vh.busDirUp = (ImageView) convertView.findViewById(R.id.bus_dir_icon_up);
      vh.busDirDown = (ImageView) convertView.findViewById(R.id.bus_dir_icon_down);
      vh.splitLine = (ImageView) convertView.findViewById(R.id.bus_seg_split_line);
      vh.expandContent = (LinearLayout) convertView.findViewById(R.id.expand_content);
      convertView.setTag(vh);
    } else {
      vh = (ViewHolder) convertView.getTag();
    }

    SchemeBusStep item = busStepList.get(position);
    if (position == 0) {
      vh.busDirIcon.setImageResource(R.drawable.dir_start);
      vh.busLineName.setText("出发");
      vh.busDirUp.setVisibility(View.INVISIBLE);
      vh.busDirDown.setVisibility(View.VISIBLE);
      vh.splitLine.setVisibility(View.GONE);
      vh.busStationNum.setVisibility(View.GONE);
      vh.busExpandImage.setVisibility(View.GONE);
      return convertView;
    } else if (position == busStepList.size() - 1) {
      vh.busDirIcon.setImageResource(R.drawable.dir_end);
      vh.busLineName.setText("到达终点");
      vh.busDirUp.setVisibility(View.VISIBLE);
      vh.busDirDown.setVisibility(View.INVISIBLE);
      vh.busStationNum.setVisibility(View.INVISIBLE);
      vh.busExpandImage.setVisibility(View.INVISIBLE);
      return convertView;
    } else {
      if (item.isWalk() && item.getWalk() != null && item.getWalk().getDistance() > 0) {
        vh.busDirIcon.setImageResource(R.drawable.dir13);
        vh.busDirUp.setVisibility(View.VISIBLE);
        vh.busDirDown.setVisibility(View.VISIBLE);
        vh.busLineName.setText("步行" + (int) item.getWalk().getDistance() + "米");
        vh.busStationNum.setVisibility(View.GONE);
        vh.busExpandImage.setVisibility(View.GONE);
        return convertView;
      } else if (item.isBus() && item.getBusLines().size() > 0) {
        vh.busDirIcon.setImageResource(R.drawable.dir14);
        vh.busDirUp.setVisibility(View.VISIBLE);
        vh.busDirDown.setVisibility(View.VISIBLE);
        vh.busLineName.setText(item.getBusLines().get(0).getBusLineName());
        vh.busStationNum.setVisibility(View.VISIBLE);
        vh.busStationNum.setText((item.getBusLines().get(0).getPassStationNum() + 1) + "站");
        vh.busExpandImage.setVisibility(View.VISIBLE);
        ArrowClick arrowClick = new ArrowClick(vh, item);
        vh.parent.setTag(position);
        vh.parent.setOnClickListener(arrowClick);
        return convertView;
      } else if (item.isRailway() && item.getRailway() != null) {
        vh.busDirIcon.setImageResource(R.drawable.dir16);
        vh.busDirUp.setVisibility(View.VISIBLE);
        vh.busDirDown.setVisibility(View.VISIBLE);
        vh.busLineName.setText(item.getRailway().getName());
        vh.busStationNum.setVisibility(View.VISIBLE);
        vh.busStationNum.setText((item.getRailway().getViastops().size() + 1) + "站");
        vh.busExpandImage.setVisibility(View.VISIBLE);
        ArrowClick arrowClick = new ArrowClick(vh, item);
        vh.parent.setTag(position);
        vh.parent.setOnClickListener(arrowClick);
        return convertView;
      } else if (item.isTaxi() && item.getTaxi() != null) {
        vh.busDirIcon.setImageResource(R.drawable.dir14);
        vh.busDirUp.setVisibility(View.VISIBLE);
        vh.busDirDown.setVisibility(View.VISIBLE);
        vh.busLineName.setText("打车到终点");
        vh.busStationNum.setVisibility(View.GONE);
        vh.busExpandImage.setVisibility(View.GONE);
        return convertView;
      }
    }

    return convertView;
  }