Android: custom separator (or even item) in ListView depening on content of item

后端 未结 2 1120
北恋
北恋 2020-11-29 23:17

I\'ve a ListView with items containing information about places with a rating and the distance to the current location.

The items a

相关标签:
2条回答
  • 2020-11-30 00:02

    Here is one implementation that does exactly what you describe.

    That one is GPLv3, because it is derived from this implementation, which was GPLv3.

    You can also use my MergeAdapter for this, which has the advantage of being Apache License 2.0. Just hand it an alternating set of header TextViews and Adapters containing each section's worth of content.

    Or, you can peek at all of these and roll their behaviors into your existing Adapter class. The trick is to return your TextView headers at the right spot, and properly implement methods like getViewTypeCount(), getItemViewType(), areAllItemsEnabled(), and isEnabled().

    0 讨论(0)
  • 2020-11-30 00:12

    Here is even nicer implementation, inspired from iOS section list view : http://code.google.com/p/android-section-list/. The nie thing about it is that the section header remains visible even if you scroll the section down.

    0 讨论(0)
提交回复
热议问题