我设置了ListView
OnItemClickListener
,每行包含ImageView
。对于某些行,我使用https://github.com/nostra13/Android-Universal-Image-Loader在此ImageView
中设置位图。对于这些行(并且仅针对这些行),当我单击ImageView
时,没有任何反应。除ImageView
之外的所有内容都正确调用onItemClick(AdapterView<?> adapterView, View view, int position, long itemId)
。我想知道如何解决这些问题。有什么想法吗?
以下是我的ListAdapter中的一些代码:
private static final ImageLoader mImageLoader = ImageLoader.getInstance();
private static final DisplayImageOptions mImageLoaderOptions =
new DisplayImageOptions.Builder().showStubImage(R.drawable.stub_image).cacheInMemory()
.imageScaleType(ImageScaleType.EXACTLY_STRETCHED).build();
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Item item = mItemList.get(position);
ListItemViewHolder holder;
if (convertView == null) {
convertView = inflater.inflate(R.layout.list_item, null);
holder =
new ListItemViewHolder(mContext, convertView);
convertView.setTag(holder);
} else {
holder = (ListItemViewHolder) convertView.getTag();
}
image = (ImageView) convertView.findViewById(R.id.receipt_icon);
mImageLoader.displayImage(someImagePath, image,
mImageLoaderOptions);
return convertView;
}
答案 0 :(得分:1)
添加
android:clickable="true"
到imageView的XML