コード例 #1
0
ファイル: TabMainView.java プロジェクト: ningzhenyu/App
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      GridCell cell = null;
      if (null == convertView) {
        convertView = LayoutInflater.from(mContext).inflate(R.layout.view_category_grid_cell, null);
        cell = new GridCell();
        cell.icon = (NumButton) convertView.findViewById(R.id.category_icon);
        cell.name = (TextView) convertView.findViewById(R.id.category_name);
        convertView.setTag(cell);
      } else {
        cell = (GridCell) convertView.getTag();
      }

      Category category = DataEngine.getInstance().getCategoryList()[position];
      cell.icon.setIconFromUrl(category.getIcon());
      cell.icon.setNum(category.getCount());
      cell.name.setText(category.getName());
      return convertView;
    }