1

Hi I am making the android layout & screen has space at the bottom but still Listview is not expanding its height. Its reserving the space of only one row.

Please suggest me what is wrong in this layout.

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/parentScrollView"
    android:layout_width="fill_parent"
    android:layout_height="match_parent"
    android:background="@color/light_white"
    android:orientation="vertical" >

    <RelativeLayout
        android:id="@+id/parentRelativeLayout"
        android:layout_width="fill_parent"
        android:layout_height="match_parent" >

        <RelativeLayout
            android:id="@+id/relativeLayoutforAds"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true" />

        <LinearLayout
            android:id="@+id/linearLayoutList"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_below="@id/relativeLayoutforAds"
            android:background="@color/black"
            android:orientation="vertical" >

            <ListView
                android:id="@android:id/list"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent" />

        </LinearLayout>
    </RelativeLayout>

</ScrollView>

enter image description here

N Sharma
  • 33,489
  • 95
  • 256
  • 444

1 Answers1

0

It solve the problem. Thanks for all to share the suggestion.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/parentRelativeLayout"
    android:layout_width="fill_parent"
    android:layout_height="match_parent" >

    <ScrollView
        android:id="@+id/parentScrollView"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@color/light_white"
        android:orientation="vertical" >

        <RelativeLayout
            android:id="@+id/relativeLayoutforAds"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true" />
    </ScrollView>

    <LinearLayout
        android:id="@+id/linearLayoutList"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_below="@id/parentScrollView"
        android:background="@android:color/white"
        android:orientation="vertical" 
        android:layout_marginTop="30dip">

        <ListView
            android:id="@android:id/list"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" />
    </LinearLayout>

</RelativeLayout>
N Sharma
  • 33,489
  • 95
  • 256
  • 444