【问题标题】:ListView with a (half- and or) hidable header带有(半和或)可隐藏标题的 ListView
【发布时间】:2012-09-10 20:30:29
【问题描述】:

我的问题是,我什至不知道要搜索什么。

我想要一个 ListView。 此 ListView 有一些具有“粘性”状态的元素。

如果我在设备上向下滚动列表,我希望所有状态为“粘滞”的 ListElements 都粘在列表顶部(不可滚动),直到有另一个“将其推开”。其余元素应该正常滚动。

我在 Google 电子市场中看到过这种列表。如果您有一个大屏幕,您可以在左侧任何应用程序的 Detailview 上看到该列表,或者如果您有 android JB,则在 google now 应用程序中的 google 搜索栏上也有相同的效果。

图一:左侧可以看到正常的ListView Image 1 http://www.android-hilfe.de/attachments/android-app-entwicklung/120884d1347256368-suche-stichwort-fuer-suche-nach-spezieller-listview-liste1.png

图二:可以看到正常的 ListView 向上滚动了一点 Image 2 http://www.android-hilfe.de/attachments/android-app-entwicklung/120885d1347256368-suche-stichwort-fuer-suche-nach-spezieller-listview-liste2.png

图片三:你可以看到,我真正想要什么。视图向上滚动,但“粘性”价格并未消失。而不是所有其他元素,都在“粘性”元素之下 Image 3 http://www.android-hilfe.de/attachments/android-app-entwicklung/120886d1347256368-suche-stichwort-fuer-suche-nach-spezieller-listview-liste3.png

我该怎么做?

【问题讨论】:

  • 我觉得不是ListView,是ScrollView,实现了onScroll方法。

标签: android android-listview custom-controls google-play


【解决方案1】:

我认为你的意思是做一些“同步滚动”。

有一篇很棒的帖子解释了他们在 Google Play 上的表现:

http://www.pushing-pixels.org/2011/07/18/android-tips-and-tricks-synchronized-scrolling.html

希望这就是你要找的东西..

【讨论】:

    【解决方案2】:

    我相信这是一个单独的组件,与 ListView 没有任何关系。

    只需创建标题,让它成为RelativeLayout 或LinearLayout,然后用设置为fill_parent 的ListView 填充其余区域。然后,当您滚动 ListView 时,“标题”将保持粘性(因为它是一个单独的组件),并且列表将向下滚动。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-11-16
      • 2012-02-17
      • 2010-10-12
      • 1970-01-01
      • 1970-01-01
      • 2022-08-23
      • 1970-01-01
      相关资源
      最近更新 更多