简体   繁体   English

视差折叠工具栏错误的滚动和布局

[英]Parallax Collapse Toolbar wrong scroll and layout

I have the following layout: 我有以下布局:

    <?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context="br.com.myproject.view.fragment.ProductActivityFragment"
    android:id="@+id/main_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/app_bar_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        android:fitsSystemWindows="true">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/collapsing_toolbar"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            tools:layout_scrollFlags="scroll|exitUntilCollapsed"
            tools:contentScrim="?attr/colorPrimary"
            tools:expandedTitleMarginStart="48dp"
            tools:expandedTitleMarginEnd="64dp"
            android:fitsSystemWindows="true">

            <ImageView
                android:id="@+id/ivImgProduct"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:scaleType="centerCrop"
                android:fitsSystemWindows="true"
                tools:layout_collapseMode="parallax"/>

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                tools:layout_scrollFlags="scroll|enterAlways"
                tools:popupTheme="@style/ThemeOverlay.AppCompat.Light"
                tools:layout_collapseMode="pin">
            </android.support.v7.widget.Toolbar>

        </android.support.design.widget.CollapsingToolbarLayout>
    </android.support.design.widget.AppBarLayout>

    <android.support.v7.widget.RecyclerView
            android:id="@+id/rvProductActions"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            tools:layout_behavior="android.support.design.widget.AppBarLayout$ScrollingViewBehavior">

        </android.support.v7.widget.RecyclerView>

</android.support.design.widget.CoordinatorLayout>

在此处输入图片说明

The RecyclerView is getting on the Toolbar are staying with an appearance "overlapped". RecyclerView进入工具栏,外观保持“重叠”状态。 The scroll both RecyclerView as the CollapsingToolbarLayout not working. 滚动两个RecyclerView作为CollapsingToolbarLayout不起作用。 I'm trying to leave my layout with the behavior as this example link , but using RecyclerView. 我正在尝试将行为作为此示例链接保留在布局中,但使用RecyclerView。

After many attempts I used a library called Android-ObservableScrollView and it worked. 经过多次尝试,我使用了一个名为Android-ObservableScrollView的库,它可以正常工作。 It is simpler to use, provides several examples and a single component already has the desired effect. 它使用起来更简单,提供了几个示例,并且单个组件已经具有预期的效果。 Scroll content has to be greater than the empty screen space for the scroll to take effect because it does not have the bounce effect of iOS. 滚动内容必须大于空白屏幕空间才能使滚动生效,因为它没有iOS的反弹效果。

您必须将app:layout_behavior =“ @ string / appbar_scrolling_view_behavior”添加到您的回收站视图

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 滚动时viewpager视差滚动和折叠工具栏 - viewpager parallax scrolling and collapse toolbar on scroll 视差和 Pin 折叠模式在折叠工具栏布局中不起作用 - Parallax and Pin collapse modes not working in Collapsing Toolbar Layout 如何在协调器布局中使用工具栏滚动和折叠LinearLayout - How to scroll and collapse a LinearLayout with Toolbar in Coordinator Layout 如何在Android中没有工具栏的情况下在片段中对布局进行视差滚动 - How to parallax scroll a layout over another in a Fragment without a Toolbar in Android 使用抽屉布局,协调器布局和片段在滚动时工具栏折叠 - Toolbar collapse on scroll with Drawer Layout, Coordinator Layout, and Fragments 一排和一排RecyclerView采用相同的布局,并且ImageView工具栏视差折叠动画 - One Vertical and One Horizontal RecyclerView in same layout and ImageView Toolbar Parallax Collapse animation 折叠工具栏布局 - Collapse Toolbar layout 折叠工具栏并在滚动条上隐藏TabLayout - Collapse Toolbar and hide TabLayout on scroll 滚动到不带工具栏的折叠视图 - Scroll to Collapse View without Toolbar 滚动上的工具栏折叠不起作用 - Toolbar collapse on Scroll does not work
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM