2

ScrollView の上にスティッキーな TextView が必要です。

テキスト ビューは画面の 50% をカバーする必要があるため、テキスト ビューと内側の線形レイアウトの重みを「1」に設定します。

しかし、TextView はまったく表示されず、ScrollView はスクロールしていません!

どんな助けでも大歓迎です!

<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:background="#000000"
    tools:context=".MainActivity" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/wallbg"
        android:gravity="bottom"
        android:orientation="vertical" >

        <TextView
            android:id="@+id/textView1"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:gravity="center"
            android:height="0dp"
            android:text="Some Text!"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textColor="@android:color/white"
            android:textSize="50sp" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:background="@drawable/wallbg"
            android:gravity="bottom"
            android:orientation="vertical" >

            <ScrollView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:fillViewport="true" >

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

                    <Button
                        android:id="@+id/btn1"
                        android:layout_width="200dp"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:layout_margin="10dp"
                        android:background="@drawable/btnbg"
                        android:text="Some Text!"
                        android:textColor="@android:color/white"
                        android:textSize="@dimen/font_size" />

                    <Button
                        android:id="@+id/btn4"
                        android:layout_width="200dp"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:layout_margin="10dp"
                        android:background="@drawable/btnbg"
                        android:text="Some Text!"
                        android:textColor="@android:color/white"
                        android:textSize="@dimen/font_size" />

                    <Button
                        android:id="@+id/btn2"
                        android:layout_width="200dp"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:layout_margin="10dp"
                        android:background="@drawable/btnbg"
                        android:text="Some Text!"
                        android:textColor="@android:color/white"
                        android:textSize="@dimen/font_size" />

                    <Button
                        android:id="@+id/btn3"
                        android:layout_width="200dp"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:layout_margin="10dp"
                        android:background="@drawable/btnbg"
                        android:text="Some Text!"
                        android:textColor="@android:color/white"
                        android:textSize="@dimen/font_size" />
                </LinearLayout>
            </ScrollView>
        </LinearLayout>
    </LinearLayout>

</RelativeLayout>
4

1 に答える 1