标签:
private void initWidth() { int screenWidth = ((MyApplication)getApplication()).screenWidth; if(0 == screenWidth){ DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); ((MyApplication)this.getApplication()).screenWidth = dm.widthPixels; screenWidth = dm.widthPixels; //得到宽度 } imageViewWidth = (screenWidth - (3*CommonUtil.dip2px(ProductListActivity.this, 10)))/2; }
//重新设置图像宽高 ViewGroup.LayoutParams params = holder.imgIconUrl0.getLayoutParams(); params.width = imageViewWidth; params.height = imageViewWidth; holder.imgIconUrl0.setLayoutParams(params); ImageLoaderUtil.displayBigImage(products.get(0).getIconUrl(), holder.imgIconUrl0, 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) {} @Override public void onLoadingCancelled(String imageUri, View view) {} });
原问题描述:我想在activity中改变图片视图的宽高属性,但是我用了一个方法后没有实现,应该要怎么实现呢?
解决方案:
在这段代码中,创建了一个新的实例并且设置了尺寸:
改变已存在的ImageView尺寸,使用这个:
标签:
原文地址:http://www.cnblogs.com/exmyth/p/4490817.html