1

私はAndroidプログラミングを初めて使用しています(実際、昨日開始しました)。私の人生では、ScrollViewをスクロールすることはできません。画面に収まらないボタンがたくさんあるので、スクロール機能を追加しようとしました。ただし、これは機能しません。それが役立つ場合は、エミュレーターを実行しています。ここに私のXMLがあります:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".UnleashedMainPageActivity" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/unleashed_Main" />

    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/textView1"
        android:layout_below="@+id/textView1"
        android:text="@string/choose_Mod" />

    <Button
        android:id="@+id/button4"
        style="?android:attr/buttonStyleSmall"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/textView2"
        android:layout_alignRight="@+id/textView2"
        android:layout_below="@+id/textView2"
        android:text="Applied Energistics" />

    <Button
        android:id="@+id/button1"
        style="?android:attr/buttonStyleSmall"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/button4"
        android:layout_alignRight="@+id/button4"
        android:layout_below="@+id/button4"
        android:text="Buildcraft" />

    <Button
        android:id="@+id/button2"
        style="?android:attr/buttonStyleSmall"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/button1"
        android:layout_alignRight="@+id/button1"
        android:layout_below="@+id/button1"
        android:text="Computer Craft" />

    <Button
        android:id="@+id/button3"
        style="?android:attr/buttonStyleSmall"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/button2"
        android:layout_alignRight="@+id/button2"
        android:layout_below="@+id/button2"
        android:text="Ender Storage" />

    <Button
        android:id="@+id/button5"
        style="?android:attr/buttonStyleSmall"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/button3"
        android:layout_alignRight="@+id/button3"
        android:layout_below="@+id/button3"
        android:text="Equivalent Exchange 3" />

    <Button
        android:id="@+id/button6"
        style="?android:attr/buttonStyleSmall"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/button5"
        android:layout_alignRight="@+id/button5"
        android:layout_below="@+id/button5"
        android:text="ExtraBiomes/Biomes O' Plenty" />
    <Button
        android:id="@+id/button7"
        style="?android:attr/buttonStyleSmall"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/button6"
        android:layout_alignRight="@+id/button6"
        android:layout_below="@+id/button6"
        android:text="Factorization" />
    <Button
        android:id="@+id/button8"
        style="?android:attr/buttonStyleSmall"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/button7"
        android:layout_alignRight="@+id/button7"
        android:layout_below="@+id/button7"
        android:text="Forestry" />
    <Button
        android:id="@+id/button9"
        style="?android:attr/buttonStyleSmall"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/button8"
        android:layout_alignRight="@+id/button8"
        android:layout_below="@+id/button8"
        android:text="IndustrialCraft 2" />

    <Button
        android:id="@+id/button10"
        style="?android:attr/buttonStyleSmall"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/button9"
        android:layout_alignRight="@+id/button9"
        android:layout_below="@+id/button9"
        android:text="MineFactory Reloaded" />

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/button10"
        android:layout_alignLeft="@+id/button4"
        android:layout_alignTop="@+id/button4"
        android:orientation="vertical" >

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

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical" >
            </LinearLayout>
        </ScrollView>

    </LinearLayout>

</RelativeLayout>
4

2 に答える 2

2

交換 :

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                    xmlns:tools="http://schemas.android.com/tools"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:paddingBottom="@dimen/activity_vertical_margin"
                    android:paddingLeft="@dimen/activity_horizontal_margin"
                    android:paddingRight="@dimen/activity_horizontal_margin"
                    android:paddingTop="@dimen/activity_vertical_margin"
                    tools:context=".UnleashedMainPageActivity" >
               <ScrollView
                         android:id="@+id/scrollView1"
                         android:layout_width="match_parent"
                         android:layout_height="match_parent" >

                                <LinearLayout
                                         android:layout_width="match_parent"
                                         android:layout_height="match_parent"
                                         android:orientation="vertical" >
                                      <TextView
                                         android:id="@+id/textView1"
                                         android:layout_width="wrap_content"
                                         android:layout_height="wrap_content"
                                         android:text="@string/unleashed_Main" />

                                      <TextView
                                         android:id="@+id/textView2"
                                         android:layout_width="wrap_content"
                                         android:layout_height="wrap_content"
                                         android:layout_alignLeft="@+id/textView1"
                                         android:layout_below="@+id/textView1"
                                         android:text="@string/choose_Mod" />

                                     <Button
                                         android:id="@+id/button4"
                                         style="?android:attr/buttonStyleSmall"
                                         android:layout_width="wrap_content"
                                         android:layout_height="wrap_content"
                                         android:layout_alignLeft="@+id/textView2"
                                         android:layout_alignRight="@+id/textView2"
                                         android:layout_below="@+id/textView2"
                                         android:text="Applied Energistics" />
                                    <Button
                                         android:id="@+id/button1"
                                         style="?android:attr/buttonStyleSmall"
                                         android:layout_width="wrap_content"
                                         android:layout_height="wrap_content"
                                         android:layout_alignLeft="@+id/button4"
                                         android:layout_alignRight="@+id/button4"
                                         android:layout_below="@+id/button4"
                                         android:text="Buildcraft" />

                                    <Button
                                         android:id="@+id/button2"
                                         style="?android:attr/buttonStyleSmall"
                                         android:layout_width="wrap_content"
                                         android:layout_height="wrap_content"
                                         android:layout_alignLeft="@+id/button1"
                                         android:layout_alignRight="@+id/button1"
                                         android:layout_below="@+id/button1"
                                         android:text="Computer Craft" />

                                    <Button
                                         android:id="@+id/button3"
                                         style="?android:attr/buttonStyleSmall"
                                         android:layout_width="wrap_content"
                                         android:layout_height="wrap_content"
                                         android:layout_alignLeft="@+id/button2"
                                         android:layout_alignRight="@+id/button2"
                                         android:layout_below="@+id/button2"
                                         android:text="Ender Storage" />

                                    <Button
                                         android:id="@+id/button5"
                                         style="?android:attr/buttonStyleSmall"
                                         android:layout_width="wrap_content"
                                         android:layout_height="wrap_content"
                                         android:layout_alignLeft="@+id/button3"
                                         android:layout_alignRight="@+id/button3"
                                         android:layout_below="@+id/button3"
                                         android:text="Equivalent Exchange 3" />

                                    <Button
                                         android:id="@+id/button6"
                                         style="?android:attr/buttonStyleSmall"
                                         android:layout_width="wrap_content"
                                         android:layout_height="wrap_content"
                                         android:layout_alignLeft="@+id/button5"
                                         android:layout_alignRight="@+id/button5"
                                         android:layout_below="@+id/button5"
                                         android:text="ExtraBiomes/Biomes O' Plenty" />
                                    <Button
                                         android:id="@+id/button7"
                                         style="?android:attr/buttonStyleSmall"
                                         android:layout_width="wrap_content"
                                         android:layout_height="wrap_content"
                                         android:layout_alignLeft="@+id/button6"
                                         android:layout_alignRight="@+id/button6"
                                         android:layout_below="@+id/button6"
                                         android:text="Factorization" />
                                    <Button
                                         android:id="@+id/button8"
                                         style="?android:attr/buttonStyleSmall"
                                         android:layout_width="wrap_content"
                                         android:layout_height="wrap_content"
                                         android:layout_alignLeft="@+id/button7"
                                         android:layout_alignRight="@+id/button7"
                                         android:layout_below="@+id/button7"
                                         android:text="Forestry" />
                                      <Button
                                         android:id="@+id/button9"
                                         style="?android:attr/buttonStyleSmall"
                                         android:layout_width="wrap_content"
                                         android:layout_height="wrap_content"
                                         android:layout_alignLeft="@+id/button8"
                                         android:layout_alignRight="@+id/button8"
                                         android:layout_below="@+id/button8"
                                         android:text="IndustrialCraft 2" />

                                     <Button
                                         android:id="@+id/button10"
                                         style="?android:attr/buttonStyleSmall"
                                         android:layout_width="wrap_content"
                                         android:layout_height="wrap_content"
                                         android:layout_alignLeft="@+id/button9"
                                         android:layout_alignRight="@+id/button9"
                                         android:layout_below="@+id/button9"
                                         android:text="MineFactory Reloaded" />
                                 </LinearLayout>
                      </ScrollView>
                </RelativeLayout>
于 2013-11-05T21:31:31.790 に答える