1

I tried a lot of things to answer this question by my self, but I can't do this. So, can you help me? :)

I want, that I can scroll a Layout. But when I try it, it's never the full height.

<?xml version="1.0" encoding="utf-8"?>

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/ScrollView01"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:orientation="vertical" >

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@color/black"
            android:orientation="vertical" >

            <LinearLayout
                android:id="@+id/LinearLayout01"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignTop="@+id/linearLayout1"
                android:layout_marginLeft="100dp"
                android:layout_toRightOf="@+id/linearLayout1"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/TextView01"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center"
                    android:text="Zeit"
                    android:textAppearance="?android:attr/textAppearanceMedium"
                    android:textColor="@color/white" />

                <ImageView
                    android:id="@+id/ImageView01"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:src="@drawable/lives" />

                <Button
                    android:id="@+id/bBuyTime"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="100 Münzen"
                    android:textColor="@color/white" />

                <TextView
                    android:id="@+id/tvTime"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="0.74"
                    android:maxLines="50"
                    android:text="Durch den Kauf erhältst du bei jedem Arcade-Spiel 10 zusätzliche Sekunden."
                    android:textAppearance="?android:attr/textAppearanceSmall"
                    android:textColor="@color/white" />
            </LinearLayout>

            <LinearLayout
                android:id="@+id/linearLayout1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:layout_toRightOf="@+id/textView1"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/textView2"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center"
                    android:text="Leben"
                    android:textAppearance="?android:attr/textAppearanceMedium"
                    android:textColor="@color/white" />

                <ImageView
                    android:id="@+id/imageView1"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:src="@drawable/lives" />

                <Button
                    android:id="@+id/bBuyLive"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="100 Münzen"
                    android:textColor="@color/white" />

                <TextView
                    android:id="@+id/tvLive"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="0.74"
                    android:maxLines="50"
                    android:text="Durch den Kauf erhältst du bei jedem Endless-Spiel ein zusätzliches Leben."
                    android:textAppearance="?android:attr/textAppearanceSmall"
                    android:textColor="@color/white" />
            </LinearLayout>

            <Button
                android:id="@+id/bShopMenu"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:layout_alignParentRight="true"
                android:text="Menü" />

            <TextView
                android:id="@+id/textView1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Shop"
                android:textAppearance="?android:attr/textAppearanceLarge"
                android:textColor="@color/white" />

            <TextView
                android:id="@+id/tvCoins"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:layout_alignParentTop="true"
                android:text="Münzen:"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textColor="@color/white" />

        </RelativeLayout>
    </LinearLayout>

</ScrollView>

I tried it on other layout.xml files and it worked. So, what did I false?

1 Answers1

0

I have tried your layout with a little bit of modification and this is what I've got.

enter image description here

What I did is to just surround whole ScrollView with another LinearLayout, and as you can see on the picture whole screen is filled with that ScrollView that is inside LinearLayout.

Height will definitely depend on the content and that will affect the scroll visibility (if there is nothing to scroll it will not be scrollable, only end of content indicator will appear)

Hope this helps :)

Nikola Milutinovic
  • 731
  • 1
  • 8
  • 23
  • I really do not know why, but I did the same like you, but it's still not working. https://www.dropbox.com/s/20mb8l82bltzw5l/Shop.jpg Thanks, but I know, that it's not scrollable yet. But I want to prepare for more things in the Shop. –  Mar 27 '14 at 15:48
  • But your RelativeLayout has also not the full height. It's only the half. Or not? –  Mar 27 '14 at 17:46