Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support android colapsing toolbar #40

Open
miladna7 opened this issue Apr 9, 2016 · 1 comment
Open

Support android colapsing toolbar #40

miladna7 opened this issue Apr 9, 2016 · 1 comment

Comments

@miladna7
Copy link

miladna7 commented Apr 9, 2016

Hello dear.
thank u for Ur amazing library.
i want to add collapsing toolbar into my activity.
i use android support library for this goal.
every thing was ok, so i just add dragger as root and add to the two needed layout.
problem is, when i start activity, layout position is nut right. for example the main child posation is in the half of screen and when i touch the screen and do some scroll, layout go up and every thing is OK.
Should i use Android-ObservableScrollView?
i think it is nothing about Observing the scroll but i think it worth to mention.
`

<com.github.ppamorim.dragger.DraggerView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/tools"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    xmlns:dragger_layout="http://schemas.android.com/apk/res-auto"
    android:id="@+id/dragger_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    dragger_layout:drag_position="right"
    dragger_layout:drag_view_id="@+id/drag_view"

    dragger_layout:shadow_view_id="@+id/shadow_view">

<FrameLayout
    android:visibility="gone"
    android:id="@+id/shadow_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/transparent" />
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/drag_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="256dp"
        android:fitsSystemWindows="true"
        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="match_parent"
            android:fitsSystemWindows="true"
            app:contentScrim="?attr/colorPrimary"
            app:expandedTitleMarginEnd="64dp"
            app:expandedTitleMarginStart="48dp"
            app:layout_scrollFlags="scroll|exitUntilCollapsed">

            <ImageView
                android:id="@+id/backdrop"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:fitsSystemWindows="true"
                android:scaleType="centerCrop"
                app:layout_collapseMode="parallax" />
            <View
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginBottom="200dp"
                android:background="@drawable/grd_collapsing_toolbar_top"
                app:layout_collapseMode="parallax"
                app:layout_collapseParallaxMultiplier="0.1"/>
            <View
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginTop="200dp"
                android:background="@drawable/grd_collapsing_toolbar_bottom"
                app:layout_collapseMode="parallax"
                app:layout_collapseParallaxMultiplier="0.1"/>

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

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

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

    <android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            android:paddingTop="24dp">

            <android.support.v7.widget.CardView

                android:id="@+id/cv"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:paddingBottom="8dp"
                android:paddingLeft="8dp"
                android:paddingRight="8dp"
                android:layout_margin="16dp">


                <RelativeLayout
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent">

                    <FrameLayout
                        android:id="@+id/fl_titlePart"
                        android:layout_width="fill_parent"
                        android:layout_height="match_parent"
                        android:background="@color/colorAccent">

                        <ImageView

                            android:id="@+id/iv_title"
                            android:layout_width="fill_parent"
                            android:layout_height="wrap_content" />

                        <TextView
                            android:id="@+id/tv_title"
                            android:layout_width="fill_parent"
                            android:layout_height="wrap_content"
                            android:gravity="center"
                            android:paddingBottom="16dp"
                            android:paddingLeft="8dp"
                            android:paddingRight="8dp"
                            android:paddingTop="16dp"
                            android:text="very very big title"
                            android:textAppearance="?android:attr/textAppearanceMedium" />
                    </FrameLayout>

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

        </LinearLayout>

    </android.support.v4.widget.NestedScrollView>

    <android.support.design.widget.FloatingActionButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="16dp"
        android:clickable="true"
        android:src="@drawable/heart_on"
        app:layout_anchor="@id/appbar"
        app:layout_anchorGravity="bottom|right|end" />
</android.support.design.widget.CoordinatorLayout>
</com.github.ppamorim.dragger.DraggerView>

`

@Nomane
Copy link

Nomane commented Apr 17, 2016

+1
Can also this library works with NestedScrollView ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants