【问题标题】:android: collapsing toolbar bounces on scroll upandroid:折叠工具栏在向上滚动时反弹
【发布时间】:2015-10-28 00:14:17
【问题描述】:

我有以下布局

<android.support.design.widget.CoordinatorLayout
    android:id="@+id/rootLayout"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:cardview="http://schemas.android.com/apk/res-auto"
    android:background="@color/white"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.design.widget.AppBarLayout
        android:fitsSystemWindows="true"
        android:layout_width="match_parent"
        android:layout_height="250dp">

         <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/collapsing_toolbar"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:minHeight="?attr/actionBarSize"
            app:layout_scrollFlags="scroll|exitUntilCollapsed"
            android:fitsSystemWindows="true">

                <RelativeLayout 
                    xmlns:android="http://schemas.android.com/apk/res/android"
                    android:id="@+id/layout_toolbar"
                    android:layout_width="fill_parent"
                    android:orientation="vertical"
                    app:layout_collapseMode="parallax" 
                    android:layout_height="match_parent">

                        <com.android.volley.toolbox.VolleyImageView 
                            android:id="@+id/image_toolbar"
                            android:layout_width="fill_parent"
                            android:layout_height="match_parent"
                            android:scaleType="centerCrop"/>

                        .... some text views aligned over image...
                </RelativeLayout>

                <android.support.v7.widget.Toolbar
                    android:id="@+id/tool_bar"
                    android:layout_width="match_parent"
                    android:layout_height="?attr/actionBarSize"
                    app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
                    app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />


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

        <android.support.v7.widget.RecyclerView
        android:id="@+id/list_brands"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
</android.support.design.widget.CoordinatorLayout>

当我在回收站视图中快速向上滚动时,折叠的工具栏无法顺利打开,而是弹跳并关闭。我不知道怎么了。我正在关注this 文章。

任何帮助将不胜感激。

【问题讨论】:

    标签: android material-design android-collapsingtoolbarlayout


    【解决方案1】:

    编辑:更新到 v23 设计和 v23 recyclerview 似乎修复了反弹效果。您还需要将 compileSdkVersion 更改为 23,并将 buildToolsVersion 更改为“23.0.0”。 如果您尝试从标题滚动,请注意 v23 有其他错误,例如崩溃

        at android.support.design.widget.CoordinatorLayout.onTouchEvent(CoordinatorLayout.java:449)
    

    这里有针对这个新错误的不同解决方案https://code.google.com/p/android/issues/detail?id=183166

    这是在 google 上跟踪的一个错误,他们说它应该在 com.android.support.design v23 中修复

    https://code.google.com/p/android/issues/detail?id=175243

    【讨论】:

    • 它似乎没有解决,因为我遇到了同样的问题,而且最新版本的谷歌 IO 应用程序也有这个问题。
    猜你喜欢
    • 1970-01-01
    • 2016-01-26
    • 1970-01-01
    • 1970-01-01
    • 2017-10-05
    • 2017-11-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多