【发布时间】:2012-07-26 00:44:57
【问题描述】:
在 Android 中是否有任何与 iPhone Aspect Fill 相关的概念。我想在 imageview 上的我的 android 图像中包含同样的概念。请给我这个概念的代码sn-p?
【问题讨论】:
-
看看这个。在这里你可以找到你的答案。 stackoverflow.com/a/2524243/614807
标签: android
在 Android 中是否有任何与 iPhone Aspect Fill 相关的概念。我想在 imageview 上的我的 android 图像中包含同样的概念。请给我这个概念的代码sn-p?
【问题讨论】:
标签: android
如果您想要一个在保持适当纵横比的同时可以上下缩放的 ImageView,请将其添加到您的 XML 中:
android:adjustViewBounds="true"
android:scaleType="centerCrop"
Look这个。
【讨论】:
我尝试了 fitCenter 但它不起作用,我最终使用了
android:scaleType="centerCrop"
android:adjustViewBounds="true"
【讨论】:
测试过!!! adjustViewBounds 需要与 scaleType centerCrop 一起为 false 以匹配 iOS 的 UIViewContentModeScaleAspectFill 行为
android:adjustViewBounds="false"
android:scaleType="centerCrop"
【讨论】: