【问题标题】:How do I make RelativeLayout disappear when scrolling in a RecyclerView在 RecyclerView 中滚动时如何使 RelativeLayout 消失
【发布时间】:2017-10-02 10:15:09
【问题描述】:

我在另一个包含 RecyclerViewRelativeLayout 中包含了一个标头 RelativeLayout。我希望标题与 RecyclerView 一起滚动,也就是说,当我向下滚动 RecyclerView 时,标题会消失,只会重新出现在最顶部。

This 是 Activity 布局(包括 RecyclerView 和标题)。 This 是标头的 XML 文件。 This 是 android Activity

【问题讨论】:

  • 为什么不在RecyclerView本身内添加标题?
  • @NileshDeokar 我认为这是不可能的。单独的 header 由 ImageView、TextView 和 LinearLayout 组成。
  • 会有什么不同?如果位置为 0,您需要做的就是膨胀 header_view

标签: java android android-recyclerview onscrolllistener


【解决方案1】:

我觉得你应该在回收站视图顶部添加标题,你可以参考这个链接在回收站视图中实现标题

https://github.com/lopspower/HFRecyclerView

在回收站视图顶部添加标题对我很有帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-03-16
    • 2016-06-11
    • 1970-01-01
    • 1970-01-01
    • 2016-02-20
    • 2015-08-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多