我的girdview只是显示,原来设定的背景,不显示真正的图片?
public View getView(final int position, View convertView, ViewGroup parent)
{
// TODO Auto-generated method stub
final ViewHolder viewHolder;
if(convertView==null)
{
convertView=mInflater.inflate(R.layout.item_gridview, parent,false);
viewHolder=new ViewHolder();
viewHolder.mImg=(ImageView) convertView.findViewById(R.id.id_item_image);
viewHolder.mSelect=(ImageButton) convertView.findViewById(R.id.id_item_select);
convertView.setTag(viewHolder);
}
else {
viewHolder=(ViewHolder) convertView.getTag();
}
//重置状态
viewHolder.mImg.setImageResource(R.drawable.plugin_camera_no_pictures);
viewHolder.mImg.setColorFilter(null);
Log.e("shuju","a111"+mDirpath+"/"+mImgPaths.get(position));
imageloader.getInstance(3,Type.LIFO).loadImage(mDirpath+"/"+mImgPaths.get(position), viewHolder.mImg);
final String filePath=mDirpath+"/"+mImgPaths.get(position);
viewHolder.mImg.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
//已经被选择
if(mSeletedImg.contains(filePath))
{
mSeletedImg.remove(filePath);
viewHolder.mImg.setColorFilter(null);
viewHolder.mSelect.setVisibility(View.GONE);
}else//未选择
{
mSeletedImg.add(filePath);
viewHolder.mImg.setColorFilter(Color.parseColor("#77000000"));
viewHolder.mSelect.setVisibility(View.VISIBLE);
}
//notifyDataSetChanged();
}
});
if(mSeletedImg.contains(filePath))
{
viewHolder.mImg.setColorFilter(Color.parseColor("#77000000"));
viewHolder.mSelect.setVisibility(View.VISIBLE);
}
return convertView;
}