1

我正在尝试将 4 个 imageViews 添加到垂直对齐的 LinearLayout 中。我希望四个图像完美堆叠,没有间距。问题是图像上方和下方都有空白区域。也许这与图像缩放的方式有关?

这是我的来源:

<?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>
4

1 回答 1

1

阿索克是对的。将 android:adjustViewBounds="true" 添加到我的 ImageView 解决了问题:)

于 2012-11-04T01:50:36.637 回答