I’ve problem similar to the one here: Android ListView doesn't expand the whole screen?
The XML is:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:id="@+id/ResultLayout">
<ScrollView android:layout_width="fill_parent" android:layout_height="fill_parent">
<ListView android:layout_width="fill_parent" android:id="@+id/ListView"
android:layout_height="fill_parent"></ListView>
</ScrollView>
<LinearLayout android:id="@+id/pagingPanel"
android:gravity="center" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:orientation="horizontal"></LinearLayout>
<Spinner android:layout_width="fill_parent" android:id="@+id/ManSpinner"
android:layout_height="fill_parent" />
</LinearLayout>
In this case, I should have a ScrollView or the PagingPanel LinearLayout will disappear.
Edit
The desired layout is to have all the elements stacked on top of each other. but if the elements exceed the page height, a scroll should be added to the ListView.
If you have a vertical
LinearLayout, You can’t have multiplefill_parentforlayout_heightof yourLinearLayoutelements. What layout you would like to achieve? Uniformly divide screen for all elements?Another problem is that using
ListViewinScrollViewis not a good idea also becauseListViewitself is scrollable.You should write what layout you would like to achieve with your XML. Also generally is a good practice to write your XML in multiple steps and iterate to woking solution layout by layout.
EDIT: Ok, try something like this: