コード例 #1
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {

    if (convertView == null) {
      LayoutInflater inflater = ((Activity) mContext).getLayoutInflater();
      convertView = inflater.inflate(mLayoutResourceId, parent, false);
    }

    TextView spinnerTitle =
        (TextView) convertView.findViewById(R.id.localization_demo_spinner_language);
    spinnerTitle.setText(FruitHelper.getFruitDisplayNameByPosition(mContext, position));
    return convertView;
  }
コード例 #2
0
  @Override
  public View getDropDownView(int position, View convertView, ViewGroup parent) {

    if (convertView == null) {
      LayoutInflater inflater = ((Activity) mContext).getLayoutInflater();
      convertView = inflater.inflate(mDropDownResourceId, parent, false);
    }

    TextView dropDownItem;
    if (convertView instanceof TextView) {
      dropDownItem = (TextView) convertView;
    } else {
      dropDownItem = (TextView) convertView.findViewById(R.id.drop_down_item);
    }

    dropDownItem.setText(FruitHelper.getFruitDisplayNameByPosition(mContext, position));

    return convertView;
  }