florent37 / DiagonalLayout

With Diagonal Layout explore new styles and approaches on material design
Apache License 2.0
2.56k stars 321 forks source link

Problem with using layout_scrollFlags #17

Open mak12 opened 7 years ago

mak12 commented 7 years ago

I want to hide toolbar and one textview when scrolling RecyclerView, its working fine using scrollFlags with AppBarLayout, but when used with diagonalLayout, its not working. Here is the scrollFlags that are working with AppBarLayout

<android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:elevation="0dp"

        android:fitsSystemWindows="true"
        android:theme="@style/AppTheme.AppBarOverlay"
        android:background="@drawable/gradient_color"
        >
        <LinearLayout
            android:layout_width="match_parent"
            android:orientation="vertical"
            android:layout_marginTop="5dp"
            app:layout_scrollFlags="scroll|enterAlways|snap"
            android:layout_height="wrap_content">
            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@android:color/transparent"
                app:popupTheme="@style/AppTheme.PopupOverlay">

                <ImageButton
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/toolbarIcon"
                    android:layout_gravity="right"
                    android:layout_marginTop="25dp"
                    android:foregroundGravity="bottom"
                    android:layout_marginRight="20dp"
                    android:background="@drawable/drawer_icon_hdpi"
                    />

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

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Fitness"
                android:textSize="25sp"
                android:textColor="@color/textColorWhite"
                android:gravity="left"
                android:layout_marginTop="10dp"
                android:layout_marginLeft="40dp"

                />
        </LinearLayout>
        <android.support.design.widget.TabLayout
            android:id="@+id/tabs"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:tabMode="fixed"
            app:tabIndicatorHeight="0dp"
            android:layout_marginTop="10dp"
            app:tabGravity="center"/>

    </android.support.design.widget.AppBarLayout>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        android:fitsSystemWindows="true"
        tools:context="com.example.spectra.fitnessapp.Activity.HomeActivity"
        android:background="@drawable/background_activity_fitness"
        >
 </RelativeLayout>

But its not working with DiagonalLayout

<com.github.florent37.diagonallayout.DiagonalLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:elevation="13dp"
        android:fitsSystemWindows="true"
        android:id="@+id/diagonalLayout"
        android:layout_margin="0dp"
        `android:padding="0dp"`
        app:diagonal_angle="9"

        app:diagonal_direction="left"
        app:diagonal_position="bottom"
        >
        <android.support.design.widget.AppBarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:elevation="0dp"
            android:fitsSystemWindows="true"
            android:theme="@style/AppTheme.AppBarOverlay"
            android:background="@drawable/gradient_color"
            >
            <LinearLayout
                android:layout_width="match_parent"
                android:orientation="vertical"
                android:layout_marginTop="5dp"
                app:layout_scrollFlags="scroll|enterAlways|snap"
                android:layout_height="wrap_content">
                <android.support.v7.widget.Toolbar
                    android:id="@+id/toolbar"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="@android:color/transparent"
                    app:popupTheme="@style/AppTheme.PopupOverlay">

                    <ImageButton
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:id="@+id/toolbarIcon"
                        android:layout_gravity="right"
                        android:foregroundGravity="bottom"
                        android:layout_marginTop="25dp"
                        android:layout_marginRight="20dp"
                        android:background="@drawable/drawer_icon_hdpi"
                        />

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

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Meal"
                    android:textSize="25sp"
                    android:textColor="@color/textColorWhite"
                    android:gravity="left"
                    android:layout_marginTop="10dp"
                    android:layout_marginLeft="40dp"

                    />

            </LinearLayout>
            <android.support.design.widget.TabLayout
                android:id="@+id/tabs"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:tabMode="fixed"
                app:tabIndicatorHeight="0dp"

                android:layout_marginTop="10dp"
                app:tabGravity="center"/>

            <View
                android:layout_width="match_parent"
                android:layout_height="50dp"></View>
        </android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>
    </com.github.florent37.diagonallayout.DiagonalLayout>