2

I have a very strange problem here. In the following xml section I'm trying to use include:

<!-- CONTENT -->
<ScrollView
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:fadingEdge="none">

  <LinearLayout
      android:layout_width="fill_parent"
      android:layout_height="fill_parent">

      <include android:id="@+id/summary"
          layout="@layout/view_summary"
          android:layout_width="fill_parent" 
          android:layout_height="fill_parent"/>

  </LinearLayout>

</ScrollView>

(the section is in a main linear layout with vertical orientation and both width and height set to fill parent)

The included xml:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@color/white">

    <ListView android:id="@+id/news_list"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1"
        android:cacheColorHint="@color/transparent"
        android:background="@color/transparent" />

    <Button android:id="@+id/news_load_more"
        android:layout_width="fill_parent"
        android:layout_height="40dip"
        android:text="Load more..."/>

</LinearLayout>

The problem is that the ListView is not taking up the whole height (the height of the screen), only the size of one single list item. I have tried setting layout parameters from code, but it didn't helped.

Any idea is welcomed. Thanks.

wallyk
  • 56,922
  • 16
  • 83
  • 148
Levente Kürti
  • 1,005
  • 1
  • 12
  • 23

3 Answers3

1

Don't put listview inside scrollview. Remove the scrollview.

SajithK
  • 832
  • 10
  • 17
0

Add android:layout_weight="0" to <Button android:id="@+id/news_load_more" ... /> This will tell it that <ListView android:id="@+id/news_list" ...> is the one to be expanded to fill its parent while the button must not.

Gallal
  • 4,267
  • 6
  • 38
  • 61
-1

Please changed android:layout_height="wrap_content" instead of android:layout_height="fill_parent"

only not changed ScrollView height property .

may be help to you.

Nikhil
  • 16,194
  • 20
  • 64
  • 81