@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
View gridView;
if (convertView == null) {
LayoutInflater inflater = (LayoutInflater)mContext.getSystemService(
Context.LAYOUT_INFLATER_SERVICE);
gridView = new View (mContext);
gridView = inflater.iflate(R.layout.gridview_item,null);
}else {
gridView = convertView;
}
TextView textView = (TextView)
gridView.findViewById(R.id.grid_item_text);
textView.setText(mThumbIds_Strings[position]);
ImageView imageView = (ImageView) gridView.findViewById(R.id.grid_item_image);
imageView.setImageResource(mThumbIds[position]);
return gridView;
}
我们想做inflate。我们将使用gridview_item
已经存在并且是Gridview
. 当我尝试运行此代码时,会出现以下错误:
LayoutInflater inflater = (LayoutInflater)mContext.getSystemService(
Context.LAYOUT_INFLATER_SERVICE);
TextView textView = (TextView)
ImageView imageView = (ImageView)