Image stretching

API 7 (2.1)

I use high resolution images for the drawable-hdpi folder of my application.

At the bottom of the screen, I have a LinearLayout with a width of fill_parent. Inside I have 3 LinearLayouts with a weight of 1. Inside them, I have an ImageView. Essentially, I have 3 identical space sizes for 3 images.

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">   
        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center">
            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/image1"
                />
        </LinearLayout>
        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center"
            android:padding="0dip">
            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/image2"
                />
        </LinearLayout>
        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center">
            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/image3"
                />
        </LinearLayout>
    </LinearLayout>

When the phone is in landscape mode, everything looks fine.

When the phone is in portrait mode, images are reduced because their width is too wide for their 1/3 of the screen space. Images still look great.

Here is my problem:

My images are scaled, but it seems that the flow around LinearLayouts with each image does not scale their height.

LinearLayouts, , . ImageView LinearLayout, , ImageView LinearLayout, . , LinearLayout == ImageView.

LinearLayouts, , , , . , LinearLayout > ImageView. .

?

LinearLayout ImageView, ImageView, , LinearLayout...

+3
3

. res layout-land. . , .

android:layout_weight="1", , ?

EDIT: , ImageView , LinerLayout . ImageViews:

Android: adjustViewBounds = ""

+4

, , , , , , . , OrientationEventListener.

0

I suppose it's better to have a different layout designed for portrait mode. Do not use the same layout for portrait and landscape modes. It would be better to have different layouts for portrait and landscape modes, so that control over the design is in our hands.

0
source

All Articles