开发者

How do I make a Button a part of a scrollable ListView?

I have a ListView with a Button below it. When I fill the list with more content than the screen size allows, so that the scroll bar appears, the Button is not part of the scrollable area. That is, the Button disappears. How do I make the Button part of the scrollable area?

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <ListView android:id="@+id/ListView" android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:layout_above="@+id/AddButton" />

    <Button android:id="@+id/AddButton" android:layout_width="fill_parent" 
        android:layout_height="wrap_content" andr开发者_JS百科oid:text="@string/add_title" />
</RelativeLayout>


Add it to the ListView as footer.


Add it with addFooterView(). This way it will always appear at the bottom of the screen while the ListView still scrolls.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜