我已阅读https://stackoverflow.com/a/2620252/779408,并且知道如何将标头添加到listview。但是,当用户向下滚动列表时,此标头不是固定的。
当用户滚动列表并使之始终显示在顶部时,如何固定ListView标头的位置?
更好的方法是在单独的布局中静态设置标头(取代ListView)。一个说明这一点的示例可能是:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<View
android:id="@+id/YOUR_HEADER_VIEW"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ListView
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
您必须将View替换为标题的View。
我希望这能解决您的问题。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句