在Spinner自定义适配器中,未调用getview方法

时间:2019-06-18 14:09:28

标签: android spinner android-arrayadapter

  

在Spinner Arrayadapter中,未调用getview方法   在微调器中显示,因此不会显示数据   微调器数据未显示在适配器中

private LayoutInflater mInflater;
ArrayList<CountryList> recordData = new ArrayList<CountryList>();
Context context;
public CustomCityListAdapter(Context context,int resourceId,int textviewId,ArrayList<CountryList> recordData) {
    super(context,resourceId,textviewId,recordData);
    // TODO Auto-generated constructor stub
    mInflater = getLayoutInflater();//LayoutInflater.from(context);
    this.context = context;
    this.recordData = recordData;
    System.out.println("Data size:"+recordData.size());
}
@Override
public View getView(int position, View convertView,ViewGroup parent) {
    final ViewHolder holder;
    if (convertView == null) {
        convertView = mInflater.inflate(R.layout.spinner_bg, null);
        holder = new ViewHolder();
        holder.txtCountryName = (TextView) convertView.findViewById(R.id.txtSpItem);
   convertView.findViewById(R.id.spinner_bg_rel);
        convertView.setTag(holder);
   holder.txtCountryName.setText(recordData.get(position).getValue());
    }        
 return convertView;

0 个答案:

没有答案