2


私は次のコードを持っています:

<ScrollView
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent">
    <LinearLayout android:orientation="vertical" 
                  android:layout_width="fill_parent" 
                  android:layout_height="fill_parent">

        <ImageView android:src="@drawable/ducks_r2_c1"
                     android:layout_width="fill_parent"
                     android:layout_height="wrap_content" />
        <ImageView android:src="@drawable/ducks_r3_c1"
                     android:layout_width="fill_parent"
                     android:layout_height="wrap_content" android:clickable="true"/>
        <ImageView android:src="@drawable/ducks_r4_c1"
                     android:layout_width="fill_parent"
                     android:layout_height="wrap_content" android:clickable="true"/>
        <ImageView android:src="@drawable/ducks_r5_c1"
                     android:layout_width="fill_parent"
                     android:layout_height="wrap_content" android:clickable="true"/>
        <ImageView android:src="@drawable/ducks_r6_c1"
                     android:layout_width="fill_parent"
                     android:layout_height="wrap_content" android:clickable="true"/>

    </LinearLayout>

</ScrollView>

私はどこでもlayout_width="fill_parent"を使用しました。しかし、これはエミュレーターにどのように表示されるかのスクリーンショットです。
ここに画像の説明を入力してください
画像の両側にスペースは必要ありません。
なんでこんな感じなの?どうすれば修正できますか?
ありがとうございました

4

2 に答える 2

1

I guess this is happening because the image is not streching.

You may try to ask the image to strech itself:

android:scaleType="fitXY"

or use it as background.

please check this thread: android: stretch image in imageview to fit screen

于 2011-08-11T19:38:41.253 に答える
0

A ScrollView will only inflate to as many items are in it.

You should be able to solve this by using a LinearLayout (or another more predictable layout) as the parent for your ScrollView with android:layout_height="match_parent" and setting the ScrollView to android:layout_height="wrap_content" and the same for layout_width on both.

于 2011-08-11T19:35:37.233 に答える