search

Home  >  Q&A  >  body text

Android PinnedHeaderListView如何切换(定位)到某一个Header?

迷茫迷茫2779 days ago698

reply all(1)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-04-17 13:44:02

    This is basically solved. Since PinnedHeaderListView inherits from ListView, there is a setSelection method in ListView.
    Solution:
    Traverse the data source List<Dish>, generate a ArrayList<Integer> positionList corresponding to the structure of PinnedHeaderListView (for distinction, it can be regarded as section positionList.add(1), when it is an ordinary list element positionList.add(0)), and then add the position where the data is "1" Go to another ArrayList<Integer> sectionPositions and call onClick() in the (你的ListView名称).setSelection(sectionPositions.get(i)) event of the menu list.
    The sliding animation effect has not been implemented, and I don’t know much about it yet.

    reply
    0
  • Cancelreply