我需要帮助为我的 GridView 设计适配器。我的StringArray
里面strings.xml
有大约 100 件物品。到目前为止我有这个,但我不确定在构造函数中放入什么来将我的 StringArray 链接到这个适配器。
public class Tab01_FavAdapter extends BaseAdapter {
private Context mContext;
private LayoutInflater mInflator;
public Tab01_FavAdapter (Context c) {
mContext = c;
mInflator = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public int getCount() {
return .size();
}
@Override
public Object getItem(int position) {
return position;
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if(convertView == null) {
convertView = mInflator.inflate(R.layout.griditemlayout, parent, false);
}
...
return convertView;
}
}