Android method of adding segment header for listview
design sketch:
I remember a similar effect on GitHub
Let's talk about the idea to achieve this effect: embed the segment header in the list item, then show or hide the segment header as needed, create a special textview and overlay it on the top of the list. When the list scrolls to a new segment, its content will be updated
Create list layout
Create an XML and reuse the layout file with the segment header scrolling with the list and the fixed segment header at the top of the list
header.xml
Main layout list.xml
Create a list item layout file_ Item.xml, containing data items and segment headers
SectionAdapter.java
main interface
The above Android method of adding segment header to listview is all the content shared by Xiaobian. I hope it can give you a reference and support more programming tips.