@Override public View getView(int position, View convertView, ViewGroup parent) { final View view; if (convertView == null) { view = mInflater.inflate(R.layout.adapter_item, parent, false); view.setTag(new Holder(view)); } else { view = convertView; } final Holder holder = (Holder) view.getTag(); final Drawable dr = mDrawableSelector.build(R.drawable.ic_android_white_48dp); holder.icon.setImageDrawable(dr); holder.text.setText(String.format("Item #%1$d", position)); return view; }
private void initMainImage() { final ImageView mainImage = findView(R.id.main_image); final DrawableSelector mainSelector = DrawableSelector.simple(this, R.color.color_1, R.color.color_7) .setEnterFadeDuration(300) .setExitFadeDuration(300) .build(); final Drawable mainDrawable = mainSelector.build(R.drawable.ic_android_white_48dp); mainImage.setImageDrawable(mainDrawable); findView(R.id.main_redraw) .setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { updateAdapterColors(); } }); }