android - 'center' 中的 'centerCrop' 和 "ImageView"有什么区别?

标签 android xml

1-android:scaleTaype="center"

2-android:scaleTaype="centerCrop"

1和2有什么区别?

最佳答案

CENTER :- 使图像在 View 中居中,但不执行缩放。

enter image description here

CENTER_CROP :- 均匀缩放图像(保持图像的纵横比),使图像的两个尺寸(宽度和高度)等于或大于 View 的相应尺寸(减去填充)。然后图像在 View 中居中。 enter image description here

引用this official documentation查看所有 ScaleTypesthis site 的概览详细解释

关于android - 'center' 中的 'centerCrop' 和 "ImageView"有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56855894/

相关文章:

android - 在 ScrollView android 中自由拖动 View

c# - 我可以在不验证的情况下加载 XmlDocument 吗?

java - 如何为 Android 游戏保存数据并访问数据?

xml - 使用 XSLT 转换其中包含 < > 的 XML

java - spring中如何通过xml文件将值传递给多个参数化的构造函数?

带有命名空间的 XML/XSD

c# - 来自 C# 中数据集的 foreach 循环中的 XML

android - greendao 按相关表中的字段排序

android - 如何将 toast 返回给在 EditText 上键入的任何内容,但特定单词除外?

java - Android-利用Canvas优化画线