滚动recyclerview时,android折叠工具栏弹跳

时间:2016-03-04 12:25:23

标签: android scroll android-recyclerview

您好我尝试使用recyclerview添加标题,因此我决定选择材质组件CoordinatorLayout& AppBarLayout然后是CollapsingToolbarLayout,

但是当我略微向上滚动时它会反弹。你可以帮助我然后还建议我如何在没有这个apporach的情况下为recyclerview添加标题,如果有任何好的例子请分享。

提前致谢!

    <?xml version="1.0" encoding="utf-8"?>
   <android.support.design.widget.CoordinatorLayout   xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:custom="http://schemas.android.com/apk/res-auto"
xmlns:wheel="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">


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

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

        <include
            app:layout_collapseMode="pin"
            layout="@layout/main_lay_header"
             />

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

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


<!--<android.support.v4.widget.SwipeRefreshLayout
    android:id="@+id/refreshDashBoard"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    -->
    <android.support.v7.widget.RecyclerView
        android:id="@+id/scrollableview"
        android:layout_width="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        android:layout_height="match_parent"
        android:layout_below="@+id/appbar"
        android:background="@color/sep_color" />
<!--</android.support.v4.widget.SwipeRefreshLayout>-->


<com.pnikosis.materialishprogress.ProgressWheel
    android:id="@+id/progress_wheel"
    android:layout_width="80dp"
    android:layout_height="80dp"
    android:layout_centerHorizontal="true"
    android:layout_gravity="center"
    android:layout_centerVertical="true"
    android:visibility="gone"
    wheel:matProg_barColor="#5588FF"
    wheel:matProg_progressIndeterminate="true" />

<doodleblue.doodleblue.com.widgets.CustomButton
    android:id="@+id/bottomBarText"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom"
    android:background="#1CD591"
    android:text="Create"
    android:textAllCaps="false"
    android:textColor="@color/white"
    android:textSize="@dimen/text_size_5"
    android:visibility="gone"
    custom:typeface="Brandon_med" />

1 个答案:

答案 0 :(得分:0)

试试这个link。希望这可以帮到你。