【问题标题】:Using static fragments with CoordinatorLayout of the new Design Support Library使用带有新设计支持库的 CoordinatorLayout 的静态片段
【发布时间】:2015-06-12 14:13:10
【问题描述】:

我一直在尝试图书馆的新产品,但我无法完全按照自己的方式定制它。

我将这个示例代码作为参考:https://github.com/chrisbanes/cheesesquare

我已经成功地添加了一个静态的fragment(包含一些带有 recyclerView 的 FrameLayout 和额外的空视图)作为 CoordinatorLayout 的子级,当滚动其中的(丑陋的)回收器视图时,它可以按预期工作。

工作的gist 和结果:

我只是想在我的片段上方添加一个额外的 CardView,当向上拖动时,它在工具栏上也应该有相同的效果。我尝试将它们与其他各种组合一起添加到 NestedScrollView 内的 LinearLayout 中,但都没有成功。每当我点击卡片视图时,它们就会被转移,再也不会回到自己的位置。此外,拖动卡片视图仍然会淡出工具栏,但不会发生其他任何事情。

不工作的gist 和结果:

【问题讨论】:

    标签: android android-support-library android-toolbar android-coordinatorlayout


    【解决方案1】:

    我使用CoordinatorLayout 作为我的片段的容器遇到了一个不同的问题:https://code.google.com/p/android/issues/detail?id=179600

    似乎CoordinatorLayout 在这个用例中存在许多问题。该解决方案可能会使用FrameLayout 来包含您的片段,然后将CoordinatorLayout 作为片段UI 的顶级容器。

    【讨论】:

      猜你喜欢
      • 2015-09-22
      • 1970-01-01
      • 2015-08-22
      • 2016-01-03
      • 1970-01-01
      • 1970-01-01
      • 2016-10-23
      • 2023-04-03
      • 1970-01-01
      相关资源
      最近更新 更多