Malinskiy / SuperRecyclerView

Pumped up RecyclerView
2.63k stars 469 forks source link

How to use CoordinatorLayout with SuperRecyclerView to hide action bar based on scroll #89

Open umesh0492 opened 8 years ago

umesh0492 commented 8 years ago

current code not working.Having latest library 23.2.0 and 1.1.3 of super recyclerview

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout
    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.support.v7.widget.CardView
        android:id="@+id/msg_box"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_gravity="center"
        android:layout_marginBottom="4dp"
        android:layout_marginLeft="4dp"
        android:layout_marginRight="4dp"
        android:layout_marginTop="4dp"
        android:background="@color/white_more_translucent"
        app:cardBackgroundColor="@android:color/white"
        app:cardCornerRadius="2dp"
        app:cardElevation="4dp"
        app:cardUseCompatPadding="false">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <com.frainz.android.ui.widgets.TypefaceEditText
                android:id="@+id/message_et"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_weight="4.2"
                android:background="@null"
                android:hint="@string/send_message"
                android:inputType="textMultiLine"
                android:maxHeight="150dp"
                android:minHeight="40dp"
                android:paddingLeft="4dp">

                <requestFocus/>
            </com.frainz.android.ui.widgets.TypefaceEditText>

            <com.frainz.android.ui.widgets.TypefaceTextView
                android:id="@+id/message_bt"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_gravity="center"
                android:layout_weight="0.8"
                android:background="@android:color/white"
                android:clickable="true"
                android:gravity="center"
                android:text="@string/fa_send"
                android:textColor="@color/colorPrimary"
                android:textSize="24sp"
                app:customTypeface="@string/font_awesome"/>

        </LinearLayout>
    </android.support.v7.widget.CardView>

    <android.support.design.widget.CoordinatorLayout

        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@id/msg_box"
        android:fitsSystemWindows="true">

        <android.support.design.widget.AppBarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:theme="@style/AppTheme.AppBarOverlay">

            <include
                android:id="@+id/action_bar"
                layout="@layout/toolbar_chat"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:minHeight="?attr/actionBarSize"/>
        </android.support.design.widget.AppBarLayout>

        <com.malinskiy.superrecyclerview.SuperRecyclerView
            android:id="@+id/chat_list"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_above="@+id/msg_box"
            android:background="@android:color/white"
            app:layout_behavior="@string/appbar_scrolling_view_behavior"
            app:layout_empty="@layout/emptyview"
            app:layout_moreProgress="@layout/view_more_progress"
            app:layout_progress="@layout/view_more_progress"
            app:mainLayoutId="@layout/layout_recyclerview_verticalscroll"
            app:recyclerClipToPadding="true"/>

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

</RelativeLayout>