关注模块,游戏推荐,资讯-关注,全部资讯,新闻搜索
This commit is contained in:
@ -153,13 +153,16 @@ public class ImageUtils {
|
||||
int width = loadedImage.getWidth();
|
||||
int height = loadedImage.getHeight();
|
||||
int widthPixels = context.getResources().getDisplayMetrics().widthPixels;
|
||||
widthPixels = widthPixels -(int)(context.getResources().getDisplayMetrics().density*10);
|
||||
float index = (float) height/(float) width;
|
||||
int newHeight = (int)(index*widthPixels);
|
||||
|
||||
ViewGroup.LayoutParams layoutParams = imageView.getLayoutParams();
|
||||
layoutParams.height = newHeight;
|
||||
layoutParams.width = widthPixels;
|
||||
imageView.setLayoutParams(layoutParams);
|
||||
if (layoutParams!=null){
|
||||
layoutParams.height = newHeight;
|
||||
layoutParams.width = widthPixels;
|
||||
imageView.setLayoutParams(layoutParams);
|
||||
}
|
||||
|
||||
if (imageView instanceof CircleImageView) {
|
||||
imageView.setScaleType(ScaleType.CENTER_CROP);
|
||||
|
||||
Reference in New Issue
Block a user