Following is my XML of my view. (I only added the structure). The problem is when I have few elements in the list view (dynamically generated), the output will show everything up to last buttons. But once the view grow passing the screen size elements after the listview do not show. But all the elements in the list view appear. How to fix it from changing this XML.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TableRow >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</TableRow>
</TableLayout>
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</ListView>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TableRow >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</TableRow>
</TableLayout>
<Button
android:layout_height="wrap_content"
android:layout_width="fill_parent" />
<Button
android:layout_height="wrap_content"
android:layout_width="fill_parent"/>
</LinearLayout>
ListVieware hungry for height. The worst case of presentingListViewis to give it height ofwrap_content.As your Items in
ListViewgrow bigger,ListViewincreases its height to wrap its content, so as a result it pushes otherViews out of the screen.I’ll suggest you to give it height of
fill_parentand play around withlayout_weightparams.For further reference, I’ll recommend you to read this article about using
RelativeLayoutto adjustListViewwith otherViewandViewGroup.