标签:
View v = LayoutInflater.from(TourBuyDetailsActivity.this ).inflate(R.layout.tour_details_header_img_item,null); final ImageView imageView = (ImageView) v.findViewById(R.id.content_pic); ImageLoader.getInstance().displayImage(travelMode.getMedia().image.get(i), imageView, new ImageLoadingListener() { @Override public void onLoadingStarted(String imageUri, View view) { } @Override public void onLoadingFailed(String imageUri, View view, FailReason failReason) { } @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { // TODO Auto-generated method stub DisplayMetrics metric = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metric); int pxWidth = metric.widthPixels; float ratio = (float)pxWidth/(float)loadedImage.getWidth(); float imageHeight = loadedImage.getHeight()*ratio; ViewGroup.LayoutParams lp = imageView.getLayoutParams(); lp.width = pxWidth; lp.height = (int)imageHeight; imageView.setLayoutParams(lp); } @Override public void onLoadingCancelled(String imageUri, View view) { } }); mImageLinearLayout.addView(v);
标签:
原文地址:http://www.cnblogs.com/yangqi0226/p/5192488.html