首页 > 移动平台 > 详细

Android ImageView 自动拉伸

时间:2018-09-13 16:05:17      阅读:240      评论:0      收藏:0      [点我收藏+]
1 int width = ScreenUtils.getScreenWidth(this);
2 int height = ScreenUtils.getScreenHeight(this);
3 mImageView = new ImageView(this);
4 mImageView.setScaleType(ImageView.ScaleType.FIT_XY);
5 mImageView.setLayoutParams(new Gallery.LayoutParams(width, height));// 设置Gallery组件的背景风格
1 ViewGroup.LayoutParams params = mImageView.getLayoutParams();
2 //设置图片的相对于屏幕的宽高比
3 params.width = width;
4 params.height = height;
5 mImageView.setLayoutParams(params);

 

Android ImageView 自动拉伸

原文:https://www.cnblogs.com/hello-studio/p/9640572.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!