Android 线性布局中的图像视图
我正在尝试向垂直对齐的线性布局添加4个图像视图。我希望这四幅图像完美地堆叠在一起,没有间隔。问题是图像上下都有空白。也许这与图像缩放的方式有关 以下是我的资料来源:Android 线性布局中的图像视图,android,android-layout,Android,Android Layout,我正在尝试向垂直对齐的线性布局添加4个图像视图。我希望这四幅图像完美地堆叠在一起,没有间隔。问题是图像上下都有空白。也许这与图像缩放的方式有关 以下是我的资料来源: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" a
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.google.ads.AdView
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:id="@+id/add1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId=""
ads:loadAdOnCreate="true"
ads:testDevices="" />
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/add1" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/menu_graphic_1"/>
<ImageView
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/menu_graphic_2" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/menu_graphic_3" />
<ImageView
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/menu_graphic_4" />
</LinearLayout>
</ScrollView>
</RelativeLayout>
Asok是对的。将android:adjustViewBounds=“true”添加到我的ImageView中修复了问题:)Asok是正确的。将android:adjustViewBounds=“true”添加到我的ImageView中修复了以下问题:)尝试将图像显示为背景而不是源,android:background=“@drawable/menu\u graphic\u 3”。您能否详细说明“上方和下方的空白”,这是在ImageView的
之间还是在其内部?您是否尝试将android:adjustViewBounds=“true”
添加到您的ImageView
?或设置ScaleType
,android:ScaleType=“fitXY”
将填充ImageView
,这意味着它将拉伸图像以适合您的需要。您能否以图像的方式显示?我在图像上方完全没有空间。请尝试将图像显示为背景而不是源,android:background=“@drawable/menu\u graphic\u 3”。您能否详细说明“上方和下方的空白”,这是在图像视图的
之间还是在其内部?您是否尝试将android:adjustViewBounds=“true”
添加到您的ImageView
?或设置ScaleType
,android:ScaleType=“fitXY”
将填充ImageView
,这意味着它将拉伸图像以适合您的需要。您能否以图像的方式显示?我在图像上方完全没有空间。