关注模块,游戏推荐,资讯-关注,全部资讯,新闻搜索

This commit is contained in:
khy
2016-08-29 12:03:08 +08:00
parent 16a65ffa93
commit 094a96ab78
49 changed files with 2947 additions and 302 deletions

View File

@ -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);