2

我在横幅(高度 48dp)和页脚(48dp)之间创建了一个带有可滚动图像的 RelativeLayout。在分辨率为 320 x 480 的手机布局上加载尺寸为 767 X 1105 的图像时,图像宽度适合设备宽度,但图像的高度会被拉伸,这会干扰纵横比。请提出解决方案。

下面是布局xml:

    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/p_1_prastavana_1"
    android:orientation="vertical" >

    <include
        android:id="@+id/banner1"
        android:layout_alignParentTop="true"
        layout="@layout/topheadings" />

    <LinearLayout
        android:id="@+id/footer1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:orientation="vertical" >

        <include layout="@layout/footer" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_above="@id/footer1"
        android:layout_below="@id/banner1" >

        <ScrollView
            android:id="@+id/scroll1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:fillViewport="false"
            android:orientation="vertical" >

            <ImageSwitcher
                android:id="@+id/content_image"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:adjustViewBounds="true"
                android:scaleType="centerCrop"
                android:src="@drawable/p_1_prastavana_1" >
            </ImageSwitcher>
        </ScrollView>
    </LinearLayout>

</RelativeLayout>
4

0 回答 0