ImageView 使边框比图像大
ImageView making the border bigger than the image
我是 XML 和 Android Studio 的新手,但属性 "wrap_content" 不应该将自己包裹在图像周围吗?
使用此代码,ImageView 看起来像这样 ImageView bigger than image
<ImageView
android:id="@+id/slika"
android:src="@drawable/kava"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:adjustViewBounds="false" />
如果我将 adjustViewBounds 更改为 "true",它看起来不错,但在纵向模式下一切都乱七八糟。
Like this
如果图像大于屏幕,ImageView
无论如何都会适合它,为此需要在其周围添加白色 spaces(如果图像大部分是水平它将在其上方和下方添加 space)。
为了适应它并丢弃白色 spaces,我发现唯一有效的属性是 android:adjustViewBounds="true"
我是 XML 和 Android Studio 的新手,但属性 "wrap_content" 不应该将自己包裹在图像周围吗? 使用此代码,ImageView 看起来像这样 ImageView bigger than image
<ImageView
android:id="@+id/slika"
android:src="@drawable/kava"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:adjustViewBounds="false" />
如果我将 adjustViewBounds 更改为 "true",它看起来不错,但在纵向模式下一切都乱七八糟。 Like this
如果图像大于屏幕,ImageView
无论如何都会适合它,为此需要在其周围添加白色 spaces(如果图像大部分是水平它将在其上方和下方添加 space)。
为了适应它并丢弃白色 spaces,我发现唯一有效的属性是 android:adjustViewBounds="true"