我想刷一个列表视图的每一行。我不知道该怎么做。在这里,我将图像和文本放在基本 adpater 中。如果我滑动特定项目更改文本框文本并更改 imagview 中的图像。
如果我刷卡意味着没有采取任何行动。
public View getView(int position, View convertView, ViewGroup parent)
{
/* bitmap=new Bitmap[itemDetailsrrayList.size()];
try
{
URL url = new URL(itemDetailsrrayList.get(position).get("image"));
HttpGet httpRequest = null;
httpRequest = new HttpGet(url.toURI());
HttpClient httpclient = new DefaultHttpClient();
HttpResponse response = (HttpResponse) httpclient.execute(httpRequest);
HttpEntity entity = response.getEntity();
BufferedHttpEntity b_entity = new BufferedHttpEntity(entity);
InputStream input = b_entity.getContent();
bitmap[position] = BitmapFactory.decodeStream(input);
} catch (URISyntaxException e)
{
Log.e("dd","d");
e.printStackTrace();
} catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}*/
ViewHolder holder;
if (convertView == null) {
convertView = l_Inflater.inflate(R.layout.item_details_view, null);
holder = new ViewHolder();
holder.txt_itemName = (TextView) convertView.findViewById(R.id.name);
holder.txt_itemDescription = (TextView) convertView.findViewById(R.id.cityState);
holder.txt_itemPrice = (TextView) convertView.findViewById(R.id.phone);
holder.itemImage = (ImageView) convertView.findViewById(R.id.photo);
holder.itemimmm=(WebView)convertView.findViewById(R.id.webView1);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.txt_itemName.setText(itemDetailsrrayList.get(position).get("id"));
holder.txt_itemDescription.setText(itemDetailsrrayList.get(position).get("name"));
holder.txt_itemPrice.setText(itemDetailsrrayList.get(position).get("price"));
holder.itemimmm.loadUrl(itemDetailsrrayList.get(position).get("image"));
//holder.itemImage.setImageBitmap(bitmap[position]);
return convertView;
}
static class ViewHolder {
WebView itemimmm;
TextView txt_itemName;
TextView txt_itemDescription;
TextView txt_itemPrice;
ImageView itemImage;
}