Android: Expand ListView to fill space between two items

Posted by BahaiResearch.com on Stack Overflow See other posts from Stack Overflow or by BahaiResearch.com
Published on 2012-06-08T22:37:47Z Indexed on 2012/06/08 22:40 UTC
Read the original article Hit count: 550

Filed under:
|

I have a ListView that is sandwiched between two buttons. The entire screen is in a ScrollView

    <Button
        android:text="Take a Picture"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+id/btnPicture"
        android:layout_marginRight="3dp"
        android:layout_marginLeft="3dp"
        android:layout_marginTop="5dp"
        android:textSize="25dp"/>
    <ListView
        android:minWidth="25px"
        android:minHeight="25px"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+id/lstPhotos"
        android:visibility="gone" />
    <Button
        android:text="Location Type"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+id/btnLocationType"
        android:layout_marginRight="3dp"
        android:layout_marginLeft="3dp"
        android:layout_marginTop="5dp"
        android:textSize="25dp" />

As I add items to the listview in code, how can I get the listview to take up enough space to be visible. It does expand to show 1 item but after I add the second item it doesn't expand any more.

You can see here after I added a second picture row to the listview, it's not visible.

enter image description here

© Stack Overflow or respective owner

Related posts about android

Related posts about listview