1

ImageView画面を左と右の2つの領域に分割しようとしていScrolViewます。ImageViewScrollViewのコンテンツをプログラムで追加しているので、レイアウトのxmlファイルは次のようになります。

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
    <FrameLayout
            android:id="@+id/scene_view"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_gravity="left"
            >
    </FrameLayout>
    <ScrollView
            android:layout_height="fill_parent"
            android:layout_width="@dimen/scrollmenu_width"
            android:layout_gravity="right"
            >
        <LinearLayout
                android:id="@+id/scrollmenu"
                android:layout_height="fill_parent"
                android:orientation="vertical"
                android:layout_width="fill_parent"
                >
        </LinearLayout>
    </ScrollView>
</FrameLayout>

私は何が間違っているのですか?ScrollView右に向かっているのですが、ImageView中央(画面に対して)が画面の左側に配置されているためです。画像の解像度が画面の解像度を超えているため、黒のspが表示されます

4

1 に答える 1

2

LinearLayoutこの問題を解決するには、とweightパラメータを使用する必要があると思います。

スニペットを編集して、どのように使用するかを理解できるようにしました。

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

    <FrameLayout
        android:id="@+id/scene_view"
        android:layout_width="0dp"
        android:layout_height="fill_parent"
        android:layout_gravity="left"
        android:layout_weight=1>
    </FrameLayout>
    <ScrollView
        android:layout_height="fill_parent"
        android:layout_width="0dp"
        android:layout_weight=1
        android:layout_gravity="right">
        <LinearLayout
            android:id="@+id/scrollmenu"
            android:layout_height="fill_parent"
            android:orientation="vertical"
            android:layout_width="fill_parent">
        </LinearLayout>
    </ScrollView>
</FrameLayout>

お役に立てば幸いです。

于 2012-01-01T15:02:17.860 に答える