2

バナー (高さ 48 dp) とフッター (48 dp) の間のスクロール可能な画像で RelativeLayout を作成しました。サイズ 767 X 1105 の画像を解像度 320 x 480 のスマートフォン レイアウトにロードすると、画像の幅はデバイスの幅に収まりますが、画像の高さが引き伸ばされて縦横比が乱れます。親切に解決策を提案してください。

以下は、レイアウト 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