Android ListView with fixed header and footer

前端 未结 7 829
半阙折子戏
半阙折子戏 2020-12-30 07:14

How can I create a ListView with fixed header and footer?

I don\'t want the header/footer to scroll with the items in the ListView.

相关标签:
7条回答
  • 2020-12-30 07:55

    we can set header and footer in this way also, i am setting header layout above listview and in same way we cans et footer below listview

    <LinearLayout
            android:id="@+id/ly_header"
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:background="@color/app_theme_color"
            android:orientation="horizontal">
            <include layout="@layout/header_icuc"/>
        </LinearLayout>
    
        <ListView
            android:id="@+id/lv_contacts"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_below="@+id/ly_header"
            android:background="#F3F4F6"
            android:divider="@drawable/contact_list_divider"
            android:dividerHeight="2dp"
            android:scrollbars="none" />
    
    0 讨论(0)
提交回复
热议问题