Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android layout issue - linearlayout height not filling scrollview height

Tags:

android

layout

I'm having a slight android layout issue...

I have a ScrollView element holding a LinearLayout. I want the scrollview to fill the entire device screen and the linearlayout to fill the whole height of the scrollview.

I have the code below which is resulting in the scrollView filling the whole screen but the linearLayout only filling about half of the height of the scrollview.

Here is my code:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#ff036c07">
    <LinearLayout
        android:background="#FF0000"
                android:id="@+id/overview_form"
                xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:tools="http://schemas.android.com/tools"
                android:orientation="vertical"
                android:layout_width="fill_parent"
              android:layout_height="fill_parent">


</LinearLayout>
</ScrollView>

Any ideas what I am missing?

like image 329
user2775405 Avatar asked Sep 13 '13 07:09

user2775405


2 Answers

Add
android:fillViewport="true"
to the scrollview .

like image 135
Anukool Avatar answered Nov 15 '22 06:11

Anukool


Add the

android:fillViewport="true" property in your ScrollView and

also remove unncessary namespace from linearlayout which is

xmlns:android="http://schemas.android.com/apk/res/android"

like image 44
GrIsHu Avatar answered Nov 15 '22 05:11

GrIsHu