0

ScrollViewにラップされているRelativeLayout内でウィジェットの長いリストを使用することは可能ですか?

<ScrollView
    android:id="@+id/scrollView1"
    android:layout_width="match_parent"
    android:layout_height="800dp"
    android:fillViewport="true" >

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="800dp"
         >

        <TextView
            android:id="@+id/screen_size_label"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentTop="true"
            android:layout_marginLeft="50dp"
            android:layout_marginTop="30dp"
            android:text="@string/screen_size" />

        <TextView
            android:id="@+id/screen_size_label2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/screen_size_label"
            android:layout_below="@+id/screen_size_label"
            android:text="@string/screen_size_label" />

        <TextView
            android:id="@+id/screen_size_label3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/screen_size_label"
            android:layout_below="@+id/screen_size_label2"
            android:text="@string/screen_size_label" />

        // each following child uses android:layout_below="@+id/previous"

画面の下部が表示されるようにかなりの量のウィジェットを貼り付けると、予想どおり、次のウィジェットが前のウィジェットの下に配置されませんが、代わりに画面ボックスに収まろうとして混乱します。代わりに必要なのは、それらを上下に配置することです。これにより、画面ボックスに収まらないものにスクロールしてアクセスできるようになります。

RellativeLayoutの代わりにLinearLayoutを使用すると正常に機能しますが、可能であれば、RelativeLayoutを使用したいと思います。

ありがとう。

4

3 に答える 3

1

との高さScrollviewRelativeLayout「fill_ parent」に変更します

于 2012-12-03T12:01:20.970 に答える
0

との高さを変更するとどうなりますScrollviewRelativeLayout

<ScrollView
android:id="@+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true" >

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
     >
于 2012-12-03T12:02:09.120 に答える
0

scrollviewの高さとrelativelayoutの高さを同じに定義すると、スクロールする必要がなくなります。したがって、scrollviewの高さをfill_parentに変更し、relativelayoutの高さをwrap_contentに変更します。

于 2012-12-03T12:06:00.833 に答える