Reputation: 12582
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>
Upvotes: 1
Views: 1083
Reputation: 37729
ListView
are hungry for height. The worst case of presenting ListView
is to give it height of wrap_content
.
As your Items in ListView
grow bigger, ListView
increases its height to wrap its content, so as a result it pushes other View
s out of the screen.
I'll suggest you to give it height of fill_parent
and play around with layout_weight
params.
For further reference, I'll recommend you to read this article about using RelativeLayout
to adjust ListView
with other View
and ViewGroup
.
Upvotes: 4