@Override public View getView(int arg0, View arg1, ViewGroup arg2) { HolerView holerView = null; if (arg1 == null) { holerView = new HolerView(); arg1 = LayoutInflater.from(ChoiceCollActivity.this) .inflate(R.layout.classification_item, arg2, false); holerView.table = (TextView) arg1.findViewById(R.id.table); holerView.img = (ImageView) arg1.findViewById(R.id.img); arg1.setTag(holerView); } else { holerView = (HolerView) arg1.getTag(); } holerView.table.setText(mCommodityListData.get(arg0)); LinearLayout.LayoutParams param = (LinearLayout.LayoutParams) holerView.img.getLayoutParams(); param.width = (mClassificationGridView.getWidth() - DensityUtils.dp2px(ChoiceCollActivity.this, 16)) / 3; param.height = (mClassificationGridView.getWidth() - DensityUtils.dp2px(ChoiceCollActivity.this, 16)) / 3; holerView.img.setLayoutParams(param); return arg1; }
@SuppressLint("ResourceAsColor") @Override public View getView(int arg0, View arg1, ViewGroup arg2) { HolerView holerView = null; if (arg1 == null) { holerView = new HolerView(); arg1 = LayoutInflater.from(ChoiceCollActivity.this) .inflate(R.layout.commodity_item, arg2, false); holerView.table = (TextView) arg1.findViewById(R.id.table); arg1.setTag(holerView); } else { holerView = (HolerView) arg1.getTag(); } RelativeLayout.LayoutParams param = (RelativeLayout.LayoutParams) holerView.table.getLayoutParams(); param.height = mCommodityListView.getHeight() / 10; holerView.table.setLayoutParams(param); holerView.table.setText(mCommodityListData.get(arg0)); if (mCommodityListFlg.get(arg0)) { holerView.table.setBackgroundResource(R.color.white); } else { holerView.table.setBackgroundResource(R.color.item_of); } return arg1; }