@Override public void onError(Integer t) { // Food food = (Food) getItem(t); View view = mListView.findViewWithTag(t); if (view != null) { ImageView iv = (ImageView) view.findViewById(R.id.img); iv.setBackgroundResource(R.drawable.activity_room_detail_area); } }
@Override public void onImageLoad(Integer t, Drawable drawable) { // BookModel model = (BookModel) getItem(t); View view = mListView.findViewWithTag(t); if (view != null) { ImageView iv = (ImageView) view.findViewById(R.id.img); iv.setBackgroundDrawable(drawable); } }
@Override protected void onPostExecute(Bitmap bitmap) { super.onPostExecute(bitmap); imageView = (ImageView) listView.findViewWithTag(ImageUrl); if (bitmap != null & imageView != null) { imageView.setImageBitmap(bitmap); } }
public void refushAtten(int position) { TextView praise = (TextView) listView.findViewWithTag("praise" + position); praise.setText(entities.get(position).praiseNum); if (Constant.PRAISE_OK.equals(entities.get(position).isPraise)) { praise.setTextColor(Color.parseColor("#499EB8")); Drawable drawable = context.getResources().getDrawable(R.mipmap.consult_atten_checked); drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight()); praise.setCompoundDrawables(drawable, null, null, null); } else { praise.setTextColor(Color.parseColor("#B3B3B3")); Drawable drawable = context.getResources().getDrawable(R.mipmap.consult_atten); drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight()); praise.setCompoundDrawables(drawable, null, null, null); } }
/** 用来加载 start 到 end 的图片 加载 指定的图片 */ public void loadImages(int start, int end) { for (int i = start; i < end; i++) { String url = NewsAdapter.URLS[i]; // 获取要加载的总图片地址 // 从缓存 中取出 对应的图片 Bitmap bitmap = getBitmapTocache(url); if (bitmap == null) { // new NewsAsyncTask(imageView, url).execute(url); NewsAsyncTask task = new NewsAsyncTask(url); task.execute(url); // 将任务列表存入集合中 mTask.add(task); } else { ImageView imageView = (ImageView) mListView.findViewWithTag(url); imageView.setImageBitmap(bitmap); } } }