예제 #1
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    // TODO Auto-generated method stub

    DrawerItemHolder drawerHolder;
    View view = convertView;
    Typeface tf = new Functions().getTypeface(getContext());
    if (view == null) {
      LayoutInflater inflater = ((Activity) context).getLayoutInflater();
      drawerHolder = new DrawerItemHolder();

      view = inflater.inflate(layoutResID, parent, false);
      drawerHolder.ItemName = (TextView) view.findViewById(R.id.cat);
      drawerHolder.icon = (ImageView) view.findViewById(R.id.icon);

      view.setTag(drawerHolder);

    } else {
      drawerHolder = (DrawerItemHolder) view.getTag();
    }

    DrawerItem dItem = (DrawerItem) this.drawerItemList.get(position);
    Picasso.with(context).load(dItem.getImgResID()).into(drawerHolder.icon);
    drawerHolder.ItemName.setTypeface(tf);
    drawerHolder.ItemName.setText(dItem.getItemName());

    return view;
  }
예제 #2
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    DrawerItemHolder drawerHolder;
    View view = convertView;

    if (view == null) {
      LayoutInflater inflater = ((Activity) context).getLayoutInflater();
      drawerHolder = new DrawerItemHolder();

      view = inflater.inflate(layoutResID, parent, false);
      drawerHolder.ItemName = (TextView) view.findViewById(R.id.drawer_itemName);
      drawerHolder.icon = (ImageView) view.findViewById(R.id.drawer_icon);

      view.setTag(drawerHolder);

    } else {
      drawerHolder = (DrawerItemHolder) view.getTag();
    }

    DrawerItem dItem = (DrawerItem) this.drawerItemList.get(position);

    drawerHolder.icon.setImageDrawable(view.getResources().getDrawable(dItem.getImgResID()));
    drawerHolder.ItemName.setText(dItem.getItemName());

    return view;
  }