[英]Android Image view stretch issue
我正在做一个项目。 在那方面,我使用ImageView
来显示来自Web URL以及本地的图像。 在该图像中无法正确显示。 我试图更改fitXY
,中心裁剪的scale属性,但无法正常工作。
可以根据我的ImageView
高度和宽度更改图像的高度和宽度,而不会影响图像质量。 或任何其他解决方法。
尝试AdjustViewBounds。
<ImageView
android:layout_width="match_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher"
android:adjustViewBounds="true"
/>
如果要使用ImageView比例类型,则这里有一些视觉上的指导。 点击这里
如果您遇到从Web URL获取图像的问题,请使用Picasso库。 要安装毕加索,请执行以下操作:在Gradle文件的依赖项中添加此compile 'com.squareup.picasso:picasso:2.5.2'
要从网络加载图像:
Picasso.with(context).load("http://i.imgur.com/DvpvklR.png").into(imageView);
在imageview中设置属性android:adjustViewBounds="true"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.