Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linearlayout below scrollview not showing up

The following should show a scrollview that takes up the entire screen except for a small portion large enough for a button at the bottom. When I run this the button/layout does not show up at all. Only the scrollview which takes up the entire screen with other views I have within the scrollview. Thoughts?

<LinearLayout android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.th3ramr0d.armybodyfatcalculator.MainActivity"
android:orientation="vertical">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

    </ScrollView>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Button 1"
        />


    </LinearLayout>
</LinearLayout
like image 979
th3ramr0d Avatar asked Sep 04 '16 21:09

th3ramr0d


1 Answers

This will do the job for you

<RelativeLayout android:layout_width="match_parent"
     android:layout_height="match_parent"
     xmlns:android="http://schemas.android.com/apk/res/android"
     tools:context="com.th3ramr0d.armybodyfatcalculator.MainActivity"
     xmlns:tools="http://schemas.android.com/tools"
     >
     <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentTop="true"
        android:layout_above="@+id/myButton">
     </ScrollView>

     <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button 1"
        android:layout_alignParentBottom="true"
        android:id="@+id/myButton" />
</RelativeLayout>
like image 157
Tiago Oliveira Avatar answered Oct 15 '22 20:10

Tiago Oliveira