Android centerInside无法将可绘制缩放到ImageView

Android centerInside无法将可绘制缩放到ImageView,android,Android,centerInside的描述 均匀缩放图像以保持图像的纵横比,使图像的尺寸、宽度和高度等于或小于视图的相应尺寸减去填充 我想这个描述意味着图像应该缩放到视图容器中最靠近它的边缘 “我的资产”文件夹中的这个小红方块似乎没有缩放 这是我的主要活动 有什么帮助吗?谢谢。是的,它做到了它所说的: 均匀缩放图像以保持图像的纵横比,使图像的尺寸、宽度和高度等于或小于视图的相应尺寸减去填充 它维护您的图像,并且大小小于父视图。如果需要图像以适合您的视图,只需在xml中添加以下行: android:scale

centerInside的描述

均匀缩放图像以保持图像的纵横比,使图像的尺寸、宽度和高度等于或小于视图的相应尺寸减去填充

我想这个描述意味着图像应该缩放到视图容器中最靠近它的边缘

“我的资产”文件夹中的这个小红方块似乎没有缩放

这是我的主要活动


有什么帮助吗?谢谢。

是的,它做到了它所说的:

均匀缩放图像以保持图像的纵横比,使图像的尺寸、宽度和高度等于或小于视图的相应尺寸减去填充

它维护您的图像,并且大小小于父视图。如果需要图像以适合您的视图,只需在xml中添加以下行:

android:scaleType="fitCenter" // change this flag as well.
android:adjustViewBounds="true" //Set this to true if you want the ImageView to adjust its bounds to preserve the aspect ratio of its drawable.

是的,它做到了它所说的:

均匀缩放图像以保持图像的纵横比,使图像的尺寸、宽度和高度等于或小于视图的相应尺寸减去填充

它维护您的图像,并且大小小于父视图。如果需要图像以适合您的视图,只需在xml中添加以下行:

android:scaleType="fitCenter" // change this flag as well.
android:adjustViewBounds="true" //Set this to true if you want the ImageView to adjust its bounds to preserve the aspect ratio of its drawable.

您共享的xml属性似乎没有我想要的效果看起来它可能工作了,唯一的问题是应用程序栏覆盖了图像视图好的,是的,它工作了,谢谢。但是,我不明白为什么centerInside不能正常工作。您共享的xml属性似乎没有我想要的效果。看起来它可能正常工作,唯一的问题是应用程序栏覆盖了图像视图。好的,是的,它正常工作,谢谢。然而,我不明白为什么centerInside不能按预期工作。
android:scaleType="fitCenter" // change this flag as well.
android:adjustViewBounds="true" //Set this to true if you want the ImageView to adjust its bounds to preserve the aspect ratio of its drawable.