我正在开发一个带有 Volley 库的 android 应用程序。
我想用 Volley 将图像异步加载到 listView 适配器中,加载后我想使图像渐变。
我的代码如下。它不好用。占位符图像变为渐变,但加载的图像不会。
你能告诉我如何解决这个问题吗?
public View getView(int position, View convertView, ViewGroup parent) {
if (null == convertView)
convertView = mInflater.inflate(R.layout.main_list_detail, null);
if (imageLoader == null)
imageLoader = AppController.getInstance().getImageLoader();
String mUrl = "http://....";
NetworkImageView imageView = (NetworkImageView)convertView.findViewById(R.id.image);
imageView.setDefaultImageResId(R.drawable.placeholder);
imageView.setErrorImageResId(R.drawable.placeholder);
imageView.setImageUrl(mURL, imageLoader);
GradientDrawable gd = new GradientDrawable(
GradientDrawable.Orientation.TOP_BOTTOM,
new int[] {Color.parseColor("#81a001"), Color.parseColor("#455600")});
gd.setStroke(1, Color.parseColor("#455600"));
imageView.setImageDrawable(gd);
return convertView;
}