Android 图像大小-如何设置?
我只想制作一个简单的图像视图,但当我运行该应用程序时,不必要的白色背景就会出现。我不想要那个零件。任何解决方案 这是我的图像视图的xml文件Android 图像大小-如何设置?,android,Android,我只想制作一个简单的图像视图,但当我运行该应用程序时,不必要的白色背景就会出现。我不想要那个零件。任何解决方案 这是我的图像视图的xml文件 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layou
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:src="@drawable/pot1"/>
</LinearLayout>
如果要将
gravity
属性粘贴到屏幕顶部,请删除该属性;如果要使其填充屏幕,请添加scaleType属性fitCenter
、cropCenter
或fitXY
。<-
imgview.setScaleType(ScaleType.FIT_XY);
或者在xml图像视图中-
android:scaleType="fitXY"
检查我的下面的回答:你想要什么来代替白色背景?如果我这样做了,那么我就丢失了图像的宽度部分