- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
正如标题所暗示的,我有一个具有 FrameLayout
的 Activity 那是我的Fragments
[我没有使用标签,只是交易]。我还有一个 NavigationDrawer
和 Toolbar
.所有这些都工作正常。
问题是我正在尝试添加 CollapsingToolbarLayout
到 Activity
布局并有RecyclerView
在Fragment
滚动并控制 CollapsingToolbarLayout
的折叠.
通过如下所示的设置,我可以使用 NavigationDrawer
, 请参阅 Toolbar
和扩展的 CollapsingToolbarLayout
里面没有图像(那里有奇怪的问题)。我加载 Fragment
进入FrameLayout
其中包含 RecyclerView
有 10 个测试 View 。这可以在 CollapsingToolbar 下方正常滚动,但不会折叠。
<android.support.v4.widget.DrawerLayout
android:id="@+id/dl_drawer_layout"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.CoordinatorLayout
android:id="@+id/cl_dashboard"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.AppBarLayout
android:id="@+id/abl_dashboard"
android:layout_width="match_parent"
android:layout_height="200dp"
android:fitsSystemWindows="true"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/ctb_dashboard"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="@color/the_color"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
android:id="@+id/iv_dashboard_header"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@mipmap/the_image"
android:fitsSystemWindows="true"
app:layout_collapseMode="parallax"/>
<include
android:id="@+id/toolbar"
layout="@layout/overlay_toolbar"
app:layout_collapseMode="pin"/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="@+id/fl_dashboard_fragmentframe"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
</FrameLayout>
</android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.NavigationView
android:id="@+id/nv_navigation_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:headerLayout="@layout/overlay_drawer_header"
app:menu="@menu/menu_drawer"/>
</android.support.v4.widget.DrawerLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_fragment_dashboardhome"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
</android.support.v7.widget.RecyclerView>
我不明白为什么这行不通,而且我浏览了很多文档和示例,但都没有成功。任何帮助或建议将不胜感激。
最佳答案
事实证明,我为 Toolbar
使用的布局没有正确的高度值。
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/get_blue"
android:elevation="5dp"
android:minHeight="?attr/actionBarSize"
app:theme="@style/actionbar_getblue">
</android.support.v7.widget.Toolbar>
<include
android:id="@+id/toolbar"
layout="@layout/overlay_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"/>
在对高度进行单一调整后,CollapsingToolbarLayout
开始完美运行。
关于android - DrawerLayout + CollapsingToolbar + fragment ;工具栏不会折叠或显示图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33132908/
我试图在展开或折叠折叠工具栏时显示标题。然而,在任何这些状态下,标题总是有一个移动动画: 如何完全摆脱动画并使标题停留在一个位置? 我试过将 titleEnabled 设置为 false,但这只会禁用
我正在尝试创建一个 CollapsingToolbarLayout,其中有一张电影海报与背景重叠。为了实现这一点,我启用了behavior_overlapTop =“67dp”,但这会导致奇怪的滚动行
我有一个 Navigation Drawer Activity (NavActivity),其中一个 fragment (OuterFrag.xml) 有一个 Collapsing Toolbar 和
我很确定这是一个错误,所以我正在寻求解决方法。我的布局是这样的: 我正在从网
在我的 CountryActivityInfo.java 中,我有一个折叠工具栏,其宽度和高度都设置为 match-parent,因此它可以占据整个手机屏幕。当我向上滚动时,工具栏会获得固定的 200
基本上,我想知道如何在使用 RecyclerView 时,如何实现一种“动画 CollapsingToolbar”。请注意,它用引号引起来,因为我没有附加到 CollapsingToolbar 的解决
我正在使用 android 支持设计 'com.android.support:design:22.2.1' 我的问题是当滚动没有内容时,折叠工具栏仍然启用折叠操作。如果滚动中没有内容,我需要删除 V
简而言之: Is this a collapsing toolbar or a Persistent Bottom Sheet? 起初我认为这是一个折叠工具栏,但在折叠工具栏上向上滚动不是那么平滑,并
我已经遇到过这个问题: MainActivity 的标题隐藏了选项卡。你能告诉我如何改变它的位置吗? Here is an XML code:
我需要知道 Material 设计库中的 CollapsingToolbar 何时折叠。 最佳答案 正如 Marko 所说,这可以使用您自己的 OnOffsetChangedListener 实现来实
如何为 RTL 语言添加一些填充到 collapsingToolbar 标题中,这对 LTR 语言很好,但对 RTL 就像下面这样.. 非常感谢 这是我的布局..正如您在上图右侧看到的那样,标题没有任
这就是我想要实现的,在 CollapsingToolbar 中的图像下方将有一个自定义布局,该布局将包含几个 View 项。 1 所需的行为是,在滚动时,底部布局会逐渐淡化和消失,顶部的图像会缩小并固
Android 中的ToolBar 和CollapsingToolBar 有什么区别?我试着在网上找到它,但找不到任何有用的资源 最佳答案 工具栏看起来像这样: 您可以将它移动到屏幕上任何您想要的位置
正如标题所暗示的,我有一个具有 FrameLayout 的 Activity 那是我的Fragments [我没有使用标签,只是交易]。我还有一个 NavigationDrawer和 Toolbar
我为 TextView 开发了一些自定义行为根据 AppBarLayout 的高度改变位置和大小在 CoordinatorLayout 里面.这样一来,标题就显得很大,并且位于完全展开的 Toolba
我的布局有一个标题部分,标题部分下面有一个图标和文本。在标题下的嵌套 ScrollView 中有更多描述(如下所示)。 当用户滚动查看更多描述时,我希望图标慢慢消失,标题文本保留在原位。但是我不确定该
如何在 Android 的折叠工具栏布局中设置标题和子标题,如 whatsapp 个人资料 View 。 我附上了相同的示例屏幕截图。 最佳答案 我终于得到了答案。请检查链接。这就是我要的。 http
我正在开发一款采用 Material Design 的 Android 应用。我有一个带有 CollapsingToolbarLayout 和 ImageView 的详细 View (到目前为止工作正
我有一个折叠式工具栏布局,如下所示: circle_image_view 在哪里 这只是一个带有圆形 mask 的标准 ImageView 。当
我正在开发像 UBER 这样的应用程序。自定义标记的第一次滚动在 map 上运行良好。之后我像 UBER 一样添加了 NestedScrollView。但是 map 滚动手势与 AppBar 滚动行为
我是一名优秀的程序员,十分优秀!