在Android中是否有与iPhone Aspect Fill相关的概念?我想在我的ImageView上实现相同的概念。请给我这个概念的代码片段。
在Android中是否有与iPhone Aspect Fill相关的概念?我想在我的ImageView上实现相同的概念。请给我这个概念的代码片段。
如果您想要一个ImageView,它可以在保持正确的长宽比的同时缩放,那么请将以下代码添加到您的XML文件中:
android:adjustViewBounds="true"
android:scaleType="centerCrop"
看看这个。
我尝试了fitCenter但它没有起作用,最后我使用了
android:scaleType="centerCrop"
android:adjustViewBounds="true"
已测试!!!adjustViewBounds
需要为false,同时scaleType
设置为centerCrop,以匹配iOS的UIViewContentModeScaleAspectFill
行为。
android:adjustViewBounds="false"
android:scaleType="centerCrop"