Search code examples
androidxmluser-interfaceandroid-linearlayoutandroid-scrollview

Android cannot re-size LinearLayout


I've been working on an android application recently, and in the last day or so I've been working on the GUI using the eclipse layout editor. Unfortunately, I can't resize my linearlayout in any way other than the x-dimension. I can also resize it by resizing the TextView contained within it. As sushil stated, I can't control the height of my linearlayout. My code:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <ScrollView
        android:id="@+id/scrollView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1" >

        <LinearLayout
            android:id="@+id/helpLinearLayout"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="top"
            android:orientation="horizontal" >

            <TextView
                android:id="@+id/InfoTitle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Info:"
                android:textSize="35sp" />
        </LinearLayout>

    </ScrollView>

</LinearLayout>

Solution

  • Try this. Add android:fillViewport="true" to the ScrollView

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