Skip to content

RecyclerView setup horizontal, when i scroll RecyclerView to right or left, SmoothAppBarLayout auto scroll  #213

Open
@vohoangtuit

Description

@vohoangtuit
  1. my file xlm

<android.support.design.widget.CoordinatorLayout 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"
xmlns:tools="http://schemas.android.com/tools">

<!--<include layout="@layout/content_scrolling"/>-->
<!--<include layout="@layout/app_bar_layout_profile" />-->
<android.support.v7.widget.RecyclerView
    android:id="@+id/recycler_view"
    android:layout_width="match_parent"
    android:layout_height="200dp"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    />
<me.henrytao.smoothappbarlayout.SmoothAppBarLayout
    android:id="@+id/smooth_app_bar_layout"
    android:layout_width="match_parent"
    android:layout_height="@dimen/app_bar_height">
    <android.support.design.widget.CollapsingToolbarLayout
        android:id="@+id/collapsing_toolbar_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"

        app:layout_scrollFlags="scroll|exitUntilCollapsed">
        <!--app:layout_scrollFlags="scroll|exitUntilCollapsed"-->
        <ImageView
            android:id="@+id/iv_background"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:scaleType="centerCrop"
            android:src="@drawable/cheese_5" />

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:layout_collapseMode="pin" />

        <me.henrytao.smoothappbarlayout.SmoothCollapsingToolbarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="left|center_vertical"
            android:minHeight="?attr/actionBarSize"
            app:sctl_avatar_id="@+id/avatar"
            app:sctl_collapsed_avatarSize="35dp"
            app:sctl_collapsed_offsetX="?attr/actionBarSize"
            app:sctl_collapsed_offsetY="0dp"
            app:sctl_collapsed_subtitleTextSize="13dp"
            app:sctl_collapsed_titleTextSize="15dp"
            app:sctl_expanded_avatarSize="50dp"
            app:sctl_expanded_offsetX="5dp"
            app:sctl_expanded_offsetY="5dp"
            app:sctl_expanded_subtitleTextSize="15dp"
            app:sctl_expanded_titleTextSize="17dp"

            app:sctl_subtitle_id="@+id/subtitle"
            app:sctl_title_id="@+id/title">

            <de.hdodenhof.circleimageview.CircleImageView
                android:id="@+id/avatar"
                android:layout_width="50dp"
                android:layout_height="50dp"
                android:layout_gravity="center_vertical"
                android:src="@drawable/avata"
                app:civ_border_color="@android:color/white"
                app:civ_border_overlay="false"
                app:civ_border_width="1dp"

                />


            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:layout_marginLeft="10dp"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/title"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:ellipsize="end"
                    android:singleLine="true"
                    android:text="Võ Hoàng Tú"
                    android:textColor="@android:color/white"
                    android:textSize="17sp" />

                <TextView
                    android:id="@+id/subtitle"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:ellipsize="end"
                    android:singleLine="true"
                    android:text="[email protected]"
                    android:textColor="@android:color/white"
                    android:textSize="13sp" />
            </LinearLayout>
        </me.henrytao.smoothappbarlayout.SmoothCollapsingToolbarLayout>
    </android.support.design.widget.CollapsingToolbarLayout>
    </me.henrytao.smoothappbarlayout.SmoothAppBarLayout>

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

  1. file java
    RecyclerView recycler_view =(RecyclerView)findViewById(R.id.recycler_view);
    LinearLayoutManager layoutManage = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false);

  2. using : compile "me.henrytao:smooth-app-bar-layout:24.1.0.0"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions