CollapsingToolbarLayout expand only when at the top Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar Manara Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Programmatically collapse or expand CollapsingToolbarLayoutShow CollapsingToolbarLayout Title ONLY when collapsedDetecting when AppBarLayout/CollapsingToolbarLayout is completely expandedUsing AppBarLayout and CollapsingToolbarLayout without a toolbarHow to expand AppBarLayout when scrolling down reaches at top of the RecyclerViewAdd icon with title in CollapsingToolbarLayoutCollapsingToolbarLayout (AppBarLayout) disable expanding on scrollCollapsingToolbarLayout with wrap_content height overlaps viewsCollapse content below toolbar with CollapsingToolbarLayoutAndroid Fragment: Top of Content is Cut Off When Vertically Centered in ScrollView

Error: Syntax error. Missing ')' for CASE Statement

Is there any hidden 'W' sound after 'comment' in : Comment est-elle?

How to open locks without disable device?

What is this word supposed to be?

c++ diamond problem - How to call base method only once

Can I criticise the more senior developers around me for not writing clean code?

Is a 5 watt UHF/VHF handheld considered QRP?

How do I check if a string is entirely made of the same substring?

Multiple fireplaces in an apartment building?

Is Diceware more secure than a long passphrase?

Additive group of local rings

Married in secret, can marital status in passport be changed at a later date?

How can I wire a 9-position switch so that each position turns on one more LED than the one before?

Second order approximation of the loss function (Deep learning book, 7.33)

Book with legacy programming code on a space ship that the main character hacks to escape

How long after the last departure shall the airport stay open for an emergency return?

PIC mathematical operations weird problem

Align column where each cell has two decimals with siunitx

Does Feeblemind produce an ongoing magical effect that can be dispelled?

What is it called when you ride around on your front wheel?

Did the Roman Empire have penal colonies?

How to avoid introduction cliches

All ASCII characters with a given bit count

Protagonist's race is hidden - should I reveal it?



CollapsingToolbarLayout expand only when at the top



Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar Manara
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!Programmatically collapse or expand CollapsingToolbarLayoutShow CollapsingToolbarLayout Title ONLY when collapsedDetecting when AppBarLayout/CollapsingToolbarLayout is completely expandedUsing AppBarLayout and CollapsingToolbarLayout without a toolbarHow to expand AppBarLayout when scrolling down reaches at top of the RecyclerViewAdd icon with title in CollapsingToolbarLayoutCollapsingToolbarLayout (AppBarLayout) disable expanding on scrollCollapsingToolbarLayout with wrap_content height overlaps viewsCollapse content below toolbar with CollapsingToolbarLayoutAndroid Fragment: Top of Content is Cut Off When Vertically Centered in ScrollView



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








8















I have some problems with AppBarLayout and CollapsingToolbarLayout. This is what currently happens:



https://www.youtube.com/watch?v=z4yD8rmjSjU



The downwards scrolling motion is exactly what I want. However when I scroll up again, the orange bar should appear immediately (which it does), but I want the ImageView to start appearing only when the user has scrolled to the very top. Can anyone help me to achieve this effect?



This is my layout xml:





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

<android.support.design.widget.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|enterAlways|exitUntilCollapsed">

<TextView
android:text="ImageView"
android:textSize="20sp"
android:textColor="@android:color/white"
android:gravity="center"
android:layout_marginTop="56dp"
android:layout_width="match_parent"
android:layout_height="145dp"
app:layout_collapseMode="parallax"
android:background="#444"/>

<TextView
android:text="Top bar"
android:textColor="@android:color/white"
android:gravity="center_vertical"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="#ff8000"
app:layout_collapseMode="pin"/>

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

<TextView
android:text="Bottom bar"
android:gravity="center_vertical"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:layout_width="match_parent"
android:textColor="@android:color/black"
android:layout_height="50dp"
android:background="#ddd"
app:layout_scrollFlags="enterAlways"/>


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

<include layout="@layout/content_scrolling"/>











share|improve this question




























    8















    I have some problems with AppBarLayout and CollapsingToolbarLayout. This is what currently happens:



    https://www.youtube.com/watch?v=z4yD8rmjSjU



    The downwards scrolling motion is exactly what I want. However when I scroll up again, the orange bar should appear immediately (which it does), but I want the ImageView to start appearing only when the user has scrolled to the very top. Can anyone help me to achieve this effect?



    This is my layout xml:





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

    <android.support.design.widget.CollapsingToolbarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:layout_scrollFlags="scroll|enterAlways|exitUntilCollapsed">

    <TextView
    android:text="ImageView"
    android:textSize="20sp"
    android:textColor="@android:color/white"
    android:gravity="center"
    android:layout_marginTop="56dp"
    android:layout_width="match_parent"
    android:layout_height="145dp"
    app:layout_collapseMode="parallax"
    android:background="#444"/>

    <TextView
    android:text="Top bar"
    android:textColor="@android:color/white"
    android:gravity="center_vertical"
    android:paddingStart="16dp"
    android:paddingEnd="16dp"
    android:layout_width="match_parent"
    android:layout_height="56dp"
    android:background="#ff8000"
    app:layout_collapseMode="pin"/>

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

    <TextView
    android:text="Bottom bar"
    android:gravity="center_vertical"
    android:paddingStart="16dp"
    android:paddingEnd="16dp"
    android:layout_width="match_parent"
    android:textColor="@android:color/black"
    android:layout_height="50dp"
    android:background="#ddd"
    app:layout_scrollFlags="enterAlways"/>


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

    <include layout="@layout/content_scrolling"/>











    share|improve this question
























      8












      8








      8


      4






      I have some problems with AppBarLayout and CollapsingToolbarLayout. This is what currently happens:



      https://www.youtube.com/watch?v=z4yD8rmjSjU



      The downwards scrolling motion is exactly what I want. However when I scroll up again, the orange bar should appear immediately (which it does), but I want the ImageView to start appearing only when the user has scrolled to the very top. Can anyone help me to achieve this effect?



      This is my layout xml:





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

      <android.support.design.widget.CollapsingToolbarLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      app:layout_scrollFlags="scroll|enterAlways|exitUntilCollapsed">

      <TextView
      android:text="ImageView"
      android:textSize="20sp"
      android:textColor="@android:color/white"
      android:gravity="center"
      android:layout_marginTop="56dp"
      android:layout_width="match_parent"
      android:layout_height="145dp"
      app:layout_collapseMode="parallax"
      android:background="#444"/>

      <TextView
      android:text="Top bar"
      android:textColor="@android:color/white"
      android:gravity="center_vertical"
      android:paddingStart="16dp"
      android:paddingEnd="16dp"
      android:layout_width="match_parent"
      android:layout_height="56dp"
      android:background="#ff8000"
      app:layout_collapseMode="pin"/>

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

      <TextView
      android:text="Bottom bar"
      android:gravity="center_vertical"
      android:paddingStart="16dp"
      android:paddingEnd="16dp"
      android:layout_width="match_parent"
      android:textColor="@android:color/black"
      android:layout_height="50dp"
      android:background="#ddd"
      app:layout_scrollFlags="enterAlways"/>


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

      <include layout="@layout/content_scrolling"/>











      share|improve this question














      I have some problems with AppBarLayout and CollapsingToolbarLayout. This is what currently happens:



      https://www.youtube.com/watch?v=z4yD8rmjSjU



      The downwards scrolling motion is exactly what I want. However when I scroll up again, the orange bar should appear immediately (which it does), but I want the ImageView to start appearing only when the user has scrolled to the very top. Can anyone help me to achieve this effect?



      This is my layout xml:





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

      <android.support.design.widget.CollapsingToolbarLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      app:layout_scrollFlags="scroll|enterAlways|exitUntilCollapsed">

      <TextView
      android:text="ImageView"
      android:textSize="20sp"
      android:textColor="@android:color/white"
      android:gravity="center"
      android:layout_marginTop="56dp"
      android:layout_width="match_parent"
      android:layout_height="145dp"
      app:layout_collapseMode="parallax"
      android:background="#444"/>

      <TextView
      android:text="Top bar"
      android:textColor="@android:color/white"
      android:gravity="center_vertical"
      android:paddingStart="16dp"
      android:paddingEnd="16dp"
      android:layout_width="match_parent"
      android:layout_height="56dp"
      android:background="#ff8000"
      app:layout_collapseMode="pin"/>

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

      <TextView
      android:text="Bottom bar"
      android:gravity="center_vertical"
      android:paddingStart="16dp"
      android:paddingEnd="16dp"
      android:layout_width="match_parent"
      android:textColor="@android:color/black"
      android:layout_height="50dp"
      android:background="#ddd"
      app:layout_scrollFlags="enterAlways"/>


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

      <include layout="@layout/content_scrolling"/>








      android android-coordinatorlayout android-collapsingtoolbarlayout android-appbarlayout






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 22 at 15:53









      Mark BuikemaMark Buikema

      2,2131837




      2,2131837






















          5 Answers
          5






          active

          oldest

          votes


















          4





          +500









          Customisation of CoordinatorLayout behaviour is hard. You want the orange bar to appear immediately but ImageView only after the content is scrolled to the top, but these views belong to one parent CollapsingToolbarLayout and both get either the behaviour you have now or the opposite with enterAlwaysCollapsed flag. I see no way to separate the behaviour for these views without messing with CoordinatorLayout/CollapsingToolbarLayout Java API.



          If simpler behaviour is not an option and noone here points out a simple solution, I suggest trying a relatively new MotionLayout instead of dancing with CollapsingToolbarLayout internals, you will save yourself a lot of time in the end. It will be a little harder at start but it provides clear ways for customisation. Here's a very good article that shows how to build a UX similar to CoordinatorLayout but using MotionLayout. And the second part of this article with some additional customisations.






          share|improve this answer
































            4





            +100









            I ended up moving the orange bar out of the CollapsingToolbarLayout and setting an OnOffsetChangedListener that changes the translationY of the top bar on the AppBarLayout.



            Setting the OnOffsetChangedListener:



            app_bar.addOnOffsetChangedListener(AppBarLayout.OnOffsetChangedListener appbar, offset ->

            topbar.translationY = Math.min(image.height.toFloat(), - offset.toFloat())

            )


            Layout:





            <android.support.design.widget.AppBarLayout
            android:id="@+id/app_bar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <TextView
            android:layout_width="match_parent"
            android:layout_height="56dp"
            android:id="@+id/topbar"
            app:elevation="8dp"
            android:elevation="8dp"
            android:background="#ff8000"
            android:gravity="center_vertical"
            android:paddingStart="16dp"
            android:paddingEnd="16dp"
            android:text="Top bar"
            android:textColor="@android:color/white"
            app:layout_scrollFlags="scroll|enterAlways" />

            <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/image"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed">

            <TextView
            android:layout_width="match_parent"
            android:layout_height="145dp"
            android:background="#444"
            android:gravity="center"
            android:text="ImageView"
            android:textColor="@android:color/white"
            android:textSize="20sp"
            app:layout_collapseMode="parallax" />


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

            <TextView
            android:id="@+id/bottombar"
            android:layout_width="match_parent"
            android:layout_height="50dp"
            app:elevation="8dp"
            android:elevation="8dp"
            android:background="#ddd"
            android:gravity="center_vertical"
            android:paddingStart="16dp"
            android:paddingEnd="16dp"
            android:text="Bottom bar"
            android:textColor="@android:color/black"
            app:layout_scrollFlags="enterAlways" />
            </android.support.design.widget.AppBarLayout>

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

            <include layout="@layout/content_scrolling"/>

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







            share|improve this answer






























              0














              I think you can manage that from your code ,I have tried that by simply detecting behavior of layout



               app_bar.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() 
              @Override
              public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset)

              if (Math.abs(verticalOffset)-appBarLayout.getTotalScrollRange() == 0)

              // Collapsed



              else

              //Expanded




              );





              share|improve this answer






























                0














                Try this @Mark.I got the scroll you showed in the Video



                <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">
                <android.support.design.widget.AppBarLayout
                android:id="@+id/app_bar"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <android.support.design.widget.CollapsingToolbarLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:layout_scrollFlags="scroll|enterAlways|exitUntilCollapsed">

                <TextView
                android:layout_width="match_parent"
                android:layout_height="145dp"
                android:layout_marginTop="56dp"
                android:background="#444"
                android:gravity="center"
                android:text="ImageView"
                android:textColor="@android:color/white"
                android:textSize="20sp"
                app:layout_collapseMode="parallax" />

                <TextView
                android:layout_width="match_parent"
                android:layout_height="56dp"
                android:background="#ff8000"
                android:gravity="center_vertical"
                android:paddingStart="16dp"
                android:paddingEnd="16dp"
                android:text="Top bar"
                android:textColor="@android:color/white"
                app:layout_collapseMode="pin" />

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

                <TextView
                android:layout_width="match_parent"
                android:layout_height="50dp"
                android:background="#ddd"
                android:gravity="center_vertical"
                android:paddingStart="16dp"
                android:paddingEnd="16dp"
                android:text="Bottom bar"
                android:textColor="@android:color/black"
                app:layout_scrollFlags="enterAlways" />
                </android.support.design.widget.AppBarLayout>


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

                <include layout="@layout/content_scrolling"/>

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





                share|improve this answer























                • The image still appears immediately when you start scrolling up again. It should only show up when the user is back at the top.

                  – Mark Buikema
                  Mar 25 at 8:37











                • So you want the image to be hidden when the user scrolls up? @MarkBuikema

                  – g.brahma Datta
                  Mar 25 at 8:56











                • Yes, the image should be hidden until the user has scrolled all the way to the top

                  – Mark Buikema
                  Mar 25 at 8:57











                • I have made the feature the same as the video. The image won't appear until the top view completely visible to the user. After it is visible then image view will appear. Or am I missing something?@MarkBuikema.I can record the feature if you want?

                  – g.brahma Datta
                  Mar 25 at 9:18












                • I have answered my own question, check it out. The image should not appear until the list is at the top.

                  – Mark Buikema
                  Mar 25 at 9:54


















                0














                There are lots of effects on the scrolling behavior that can be achieved by setting different layout_scrollFlags. In your case, I think the flag you want is enterAlwaysCollapsed. Add the flag along with enterAlways instead of replacing all the flags.



                scroll will make the toolbar scroll like the rest of the content, enterAlways will make the toolbar AND the rest of the CollapsingToolbarLayout to pop back immediately after scroll up, whereas enterAlwaysCollapsed only expands the CollapsingToolbarLayout after the page is scrolled all the way to the top.



                Here's the effect that enterAlwaysCollapsed achieves.






                share|improve this answer

























                  Your Answer






                  StackExchange.ifUsing("editor", function ()
                  StackExchange.using("externalEditor", function ()
                  StackExchange.using("snippets", function ()
                  StackExchange.snippets.init();
                  );
                  );
                  , "code-snippets");

                  StackExchange.ready(function()
                  var channelOptions =
                  tags: "".split(" "),
                  id: "1"
                  ;
                  initTagRenderer("".split(" "), "".split(" "), channelOptions);

                  StackExchange.using("externalEditor", function()
                  // Have to fire editor after snippets, if snippets enabled
                  if (StackExchange.settings.snippets.snippetsEnabled)
                  StackExchange.using("snippets", function()
                  createEditor();
                  );

                  else
                  createEditor();

                  );

                  function createEditor()
                  StackExchange.prepareEditor(
                  heartbeatType: 'answer',
                  autoActivateHeartbeat: false,
                  convertImagesToLinks: true,
                  noModals: true,
                  showLowRepImageUploadWarning: true,
                  reputationToPostImages: 10,
                  bindNavPrevention: true,
                  postfix: "",
                  imageUploader:
                  brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                  contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                  allowUrls: true
                  ,
                  onDemand: true,
                  discardSelector: ".discard-answer"
                  ,immediatelyShowMarkdownHelp:true
                  );



                  );













                  draft saved

                  draft discarded


















                  StackExchange.ready(
                  function ()
                  StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55303420%2fcollapsingtoolbarlayout-expand-only-when-at-the-top%23new-answer', 'question_page');

                  );

                  Post as a guest















                  Required, but never shown

























                  5 Answers
                  5






                  active

                  oldest

                  votes








                  5 Answers
                  5






                  active

                  oldest

                  votes









                  active

                  oldest

                  votes






                  active

                  oldest

                  votes









                  4





                  +500









                  Customisation of CoordinatorLayout behaviour is hard. You want the orange bar to appear immediately but ImageView only after the content is scrolled to the top, but these views belong to one parent CollapsingToolbarLayout and both get either the behaviour you have now or the opposite with enterAlwaysCollapsed flag. I see no way to separate the behaviour for these views without messing with CoordinatorLayout/CollapsingToolbarLayout Java API.



                  If simpler behaviour is not an option and noone here points out a simple solution, I suggest trying a relatively new MotionLayout instead of dancing with CollapsingToolbarLayout internals, you will save yourself a lot of time in the end. It will be a little harder at start but it provides clear ways for customisation. Here's a very good article that shows how to build a UX similar to CoordinatorLayout but using MotionLayout. And the second part of this article with some additional customisations.






                  share|improve this answer





























                    4





                    +500









                    Customisation of CoordinatorLayout behaviour is hard. You want the orange bar to appear immediately but ImageView only after the content is scrolled to the top, but these views belong to one parent CollapsingToolbarLayout and both get either the behaviour you have now or the opposite with enterAlwaysCollapsed flag. I see no way to separate the behaviour for these views without messing with CoordinatorLayout/CollapsingToolbarLayout Java API.



                    If simpler behaviour is not an option and noone here points out a simple solution, I suggest trying a relatively new MotionLayout instead of dancing with CollapsingToolbarLayout internals, you will save yourself a lot of time in the end. It will be a little harder at start but it provides clear ways for customisation. Here's a very good article that shows how to build a UX similar to CoordinatorLayout but using MotionLayout. And the second part of this article with some additional customisations.






                    share|improve this answer



























                      4





                      +500







                      4





                      +500



                      4




                      +500





                      Customisation of CoordinatorLayout behaviour is hard. You want the orange bar to appear immediately but ImageView only after the content is scrolled to the top, but these views belong to one parent CollapsingToolbarLayout and both get either the behaviour you have now or the opposite with enterAlwaysCollapsed flag. I see no way to separate the behaviour for these views without messing with CoordinatorLayout/CollapsingToolbarLayout Java API.



                      If simpler behaviour is not an option and noone here points out a simple solution, I suggest trying a relatively new MotionLayout instead of dancing with CollapsingToolbarLayout internals, you will save yourself a lot of time in the end. It will be a little harder at start but it provides clear ways for customisation. Here's a very good article that shows how to build a UX similar to CoordinatorLayout but using MotionLayout. And the second part of this article with some additional customisations.






                      share|improve this answer















                      Customisation of CoordinatorLayout behaviour is hard. You want the orange bar to appear immediately but ImageView only after the content is scrolled to the top, but these views belong to one parent CollapsingToolbarLayout and both get either the behaviour you have now or the opposite with enterAlwaysCollapsed flag. I see no way to separate the behaviour for these views without messing with CoordinatorLayout/CollapsingToolbarLayout Java API.



                      If simpler behaviour is not an option and noone here points out a simple solution, I suggest trying a relatively new MotionLayout instead of dancing with CollapsingToolbarLayout internals, you will save yourself a lot of time in the end. It will be a little harder at start but it provides clear ways for customisation. Here's a very good article that shows how to build a UX similar to CoordinatorLayout but using MotionLayout. And the second part of this article with some additional customisations.







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Mar 25 at 9:00

























                      answered Mar 24 at 21:08









                      DmideDmide

                      5,61931728




                      5,61931728























                          4





                          +100









                          I ended up moving the orange bar out of the CollapsingToolbarLayout and setting an OnOffsetChangedListener that changes the translationY of the top bar on the AppBarLayout.



                          Setting the OnOffsetChangedListener:



                          app_bar.addOnOffsetChangedListener(AppBarLayout.OnOffsetChangedListener appbar, offset ->

                          topbar.translationY = Math.min(image.height.toFloat(), - offset.toFloat())

                          )


                          Layout:





                          <android.support.design.widget.AppBarLayout
                          android:id="@+id/app_bar"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content">

                          <TextView
                          android:layout_width="match_parent"
                          android:layout_height="56dp"
                          android:id="@+id/topbar"
                          app:elevation="8dp"
                          android:elevation="8dp"
                          android:background="#ff8000"
                          android:gravity="center_vertical"
                          android:paddingStart="16dp"
                          android:paddingEnd="16dp"
                          android:text="Top bar"
                          android:textColor="@android:color/white"
                          app:layout_scrollFlags="scroll|enterAlways" />

                          <android.support.design.widget.CollapsingToolbarLayout
                          android:id="@+id/image"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed">

                          <TextView
                          android:layout_width="match_parent"
                          android:layout_height="145dp"
                          android:background="#444"
                          android:gravity="center"
                          android:text="ImageView"
                          android:textColor="@android:color/white"
                          android:textSize="20sp"
                          app:layout_collapseMode="parallax" />


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

                          <TextView
                          android:id="@+id/bottombar"
                          android:layout_width="match_parent"
                          android:layout_height="50dp"
                          app:elevation="8dp"
                          android:elevation="8dp"
                          android:background="#ddd"
                          android:gravity="center_vertical"
                          android:paddingStart="16dp"
                          android:paddingEnd="16dp"
                          android:text="Bottom bar"
                          android:textColor="@android:color/black"
                          app:layout_scrollFlags="enterAlways" />
                          </android.support.design.widget.AppBarLayout>

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

                          <include layout="@layout/content_scrolling"/>

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







                          share|improve this answer



























                            4





                            +100









                            I ended up moving the orange bar out of the CollapsingToolbarLayout and setting an OnOffsetChangedListener that changes the translationY of the top bar on the AppBarLayout.



                            Setting the OnOffsetChangedListener:



                            app_bar.addOnOffsetChangedListener(AppBarLayout.OnOffsetChangedListener appbar, offset ->

                            topbar.translationY = Math.min(image.height.toFloat(), - offset.toFloat())

                            )


                            Layout:





                            <android.support.design.widget.AppBarLayout
                            android:id="@+id/app_bar"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content">

                            <TextView
                            android:layout_width="match_parent"
                            android:layout_height="56dp"
                            android:id="@+id/topbar"
                            app:elevation="8dp"
                            android:elevation="8dp"
                            android:background="#ff8000"
                            android:gravity="center_vertical"
                            android:paddingStart="16dp"
                            android:paddingEnd="16dp"
                            android:text="Top bar"
                            android:textColor="@android:color/white"
                            app:layout_scrollFlags="scroll|enterAlways" />

                            <android.support.design.widget.CollapsingToolbarLayout
                            android:id="@+id/image"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed">

                            <TextView
                            android:layout_width="match_parent"
                            android:layout_height="145dp"
                            android:background="#444"
                            android:gravity="center"
                            android:text="ImageView"
                            android:textColor="@android:color/white"
                            android:textSize="20sp"
                            app:layout_collapseMode="parallax" />


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

                            <TextView
                            android:id="@+id/bottombar"
                            android:layout_width="match_parent"
                            android:layout_height="50dp"
                            app:elevation="8dp"
                            android:elevation="8dp"
                            android:background="#ddd"
                            android:gravity="center_vertical"
                            android:paddingStart="16dp"
                            android:paddingEnd="16dp"
                            android:text="Bottom bar"
                            android:textColor="@android:color/black"
                            app:layout_scrollFlags="enterAlways" />
                            </android.support.design.widget.AppBarLayout>

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

                            <include layout="@layout/content_scrolling"/>

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







                            share|improve this answer

























                              4





                              +100







                              4





                              +100



                              4




                              +100





                              I ended up moving the orange bar out of the CollapsingToolbarLayout and setting an OnOffsetChangedListener that changes the translationY of the top bar on the AppBarLayout.



                              Setting the OnOffsetChangedListener:



                              app_bar.addOnOffsetChangedListener(AppBarLayout.OnOffsetChangedListener appbar, offset ->

                              topbar.translationY = Math.min(image.height.toFloat(), - offset.toFloat())

                              )


                              Layout:





                              <android.support.design.widget.AppBarLayout
                              android:id="@+id/app_bar"
                              android:layout_width="match_parent"
                              android:layout_height="wrap_content">

                              <TextView
                              android:layout_width="match_parent"
                              android:layout_height="56dp"
                              android:id="@+id/topbar"
                              app:elevation="8dp"
                              android:elevation="8dp"
                              android:background="#ff8000"
                              android:gravity="center_vertical"
                              android:paddingStart="16dp"
                              android:paddingEnd="16dp"
                              android:text="Top bar"
                              android:textColor="@android:color/white"
                              app:layout_scrollFlags="scroll|enterAlways" />

                              <android.support.design.widget.CollapsingToolbarLayout
                              android:id="@+id/image"
                              android:layout_width="match_parent"
                              android:layout_height="wrap_content"
                              app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed">

                              <TextView
                              android:layout_width="match_parent"
                              android:layout_height="145dp"
                              android:background="#444"
                              android:gravity="center"
                              android:text="ImageView"
                              android:textColor="@android:color/white"
                              android:textSize="20sp"
                              app:layout_collapseMode="parallax" />


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

                              <TextView
                              android:id="@+id/bottombar"
                              android:layout_width="match_parent"
                              android:layout_height="50dp"
                              app:elevation="8dp"
                              android:elevation="8dp"
                              android:background="#ddd"
                              android:gravity="center_vertical"
                              android:paddingStart="16dp"
                              android:paddingEnd="16dp"
                              android:text="Bottom bar"
                              android:textColor="@android:color/black"
                              app:layout_scrollFlags="enterAlways" />
                              </android.support.design.widget.AppBarLayout>

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

                              <include layout="@layout/content_scrolling"/>

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







                              share|improve this answer













                              I ended up moving the orange bar out of the CollapsingToolbarLayout and setting an OnOffsetChangedListener that changes the translationY of the top bar on the AppBarLayout.



                              Setting the OnOffsetChangedListener:



                              app_bar.addOnOffsetChangedListener(AppBarLayout.OnOffsetChangedListener appbar, offset ->

                              topbar.translationY = Math.min(image.height.toFloat(), - offset.toFloat())

                              )


                              Layout:





                              <android.support.design.widget.AppBarLayout
                              android:id="@+id/app_bar"
                              android:layout_width="match_parent"
                              android:layout_height="wrap_content">

                              <TextView
                              android:layout_width="match_parent"
                              android:layout_height="56dp"
                              android:id="@+id/topbar"
                              app:elevation="8dp"
                              android:elevation="8dp"
                              android:background="#ff8000"
                              android:gravity="center_vertical"
                              android:paddingStart="16dp"
                              android:paddingEnd="16dp"
                              android:text="Top bar"
                              android:textColor="@android:color/white"
                              app:layout_scrollFlags="scroll|enterAlways" />

                              <android.support.design.widget.CollapsingToolbarLayout
                              android:id="@+id/image"
                              android:layout_width="match_parent"
                              android:layout_height="wrap_content"
                              app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed">

                              <TextView
                              android:layout_width="match_parent"
                              android:layout_height="145dp"
                              android:background="#444"
                              android:gravity="center"
                              android:text="ImageView"
                              android:textColor="@android:color/white"
                              android:textSize="20sp"
                              app:layout_collapseMode="parallax" />


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

                              <TextView
                              android:id="@+id/bottombar"
                              android:layout_width="match_parent"
                              android:layout_height="50dp"
                              app:elevation="8dp"
                              android:elevation="8dp"
                              android:background="#ddd"
                              android:gravity="center_vertical"
                              android:paddingStart="16dp"
                              android:paddingEnd="16dp"
                              android:text="Bottom bar"
                              android:textColor="@android:color/black"
                              app:layout_scrollFlags="enterAlways" />
                              </android.support.design.widget.AppBarLayout>

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

                              <include layout="@layout/content_scrolling"/>

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








                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Mar 25 at 9:04









                              Mark BuikemaMark Buikema

                              2,2131837




                              2,2131837





















                                  0














                                  I think you can manage that from your code ,I have tried that by simply detecting behavior of layout



                                   app_bar.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() 
                                  @Override
                                  public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset)

                                  if (Math.abs(verticalOffset)-appBarLayout.getTotalScrollRange() == 0)

                                  // Collapsed



                                  else

                                  //Expanded




                                  );





                                  share|improve this answer



























                                    0














                                    I think you can manage that from your code ,I have tried that by simply detecting behavior of layout



                                     app_bar.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() 
                                    @Override
                                    public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset)

                                    if (Math.abs(verticalOffset)-appBarLayout.getTotalScrollRange() == 0)

                                    // Collapsed



                                    else

                                    //Expanded




                                    );





                                    share|improve this answer

























                                      0












                                      0








                                      0







                                      I think you can manage that from your code ,I have tried that by simply detecting behavior of layout



                                       app_bar.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() 
                                      @Override
                                      public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset)

                                      if (Math.abs(verticalOffset)-appBarLayout.getTotalScrollRange() == 0)

                                      // Collapsed



                                      else

                                      //Expanded




                                      );





                                      share|improve this answer













                                      I think you can manage that from your code ,I have tried that by simply detecting behavior of layout



                                       app_bar.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() 
                                      @Override
                                      public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset)

                                      if (Math.abs(verticalOffset)-appBarLayout.getTotalScrollRange() == 0)

                                      // Collapsed



                                      else

                                      //Expanded




                                      );






                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Mar 25 at 6:09









                                      richa shahricha shah

                                      1078




                                      1078





















                                          0














                                          Try this @Mark.I got the scroll you showed in the Video



                                          <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">
                                          <android.support.design.widget.AppBarLayout
                                          android:id="@+id/app_bar"
                                          android:layout_width="match_parent"
                                          android:layout_height="wrap_content">

                                          <android.support.design.widget.CollapsingToolbarLayout
                                          android:layout_width="match_parent"
                                          android:layout_height="wrap_content"
                                          app:layout_scrollFlags="scroll|enterAlways|exitUntilCollapsed">

                                          <TextView
                                          android:layout_width="match_parent"
                                          android:layout_height="145dp"
                                          android:layout_marginTop="56dp"
                                          android:background="#444"
                                          android:gravity="center"
                                          android:text="ImageView"
                                          android:textColor="@android:color/white"
                                          android:textSize="20sp"
                                          app:layout_collapseMode="parallax" />

                                          <TextView
                                          android:layout_width="match_parent"
                                          android:layout_height="56dp"
                                          android:background="#ff8000"
                                          android:gravity="center_vertical"
                                          android:paddingStart="16dp"
                                          android:paddingEnd="16dp"
                                          android:text="Top bar"
                                          android:textColor="@android:color/white"
                                          app:layout_collapseMode="pin" />

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

                                          <TextView
                                          android:layout_width="match_parent"
                                          android:layout_height="50dp"
                                          android:background="#ddd"
                                          android:gravity="center_vertical"
                                          android:paddingStart="16dp"
                                          android:paddingEnd="16dp"
                                          android:text="Bottom bar"
                                          android:textColor="@android:color/black"
                                          app:layout_scrollFlags="enterAlways" />
                                          </android.support.design.widget.AppBarLayout>


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

                                          <include layout="@layout/content_scrolling"/>

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





                                          share|improve this answer























                                          • The image still appears immediately when you start scrolling up again. It should only show up when the user is back at the top.

                                            – Mark Buikema
                                            Mar 25 at 8:37











                                          • So you want the image to be hidden when the user scrolls up? @MarkBuikema

                                            – g.brahma Datta
                                            Mar 25 at 8:56











                                          • Yes, the image should be hidden until the user has scrolled all the way to the top

                                            – Mark Buikema
                                            Mar 25 at 8:57











                                          • I have made the feature the same as the video. The image won't appear until the top view completely visible to the user. After it is visible then image view will appear. Or am I missing something?@MarkBuikema.I can record the feature if you want?

                                            – g.brahma Datta
                                            Mar 25 at 9:18












                                          • I have answered my own question, check it out. The image should not appear until the list is at the top.

                                            – Mark Buikema
                                            Mar 25 at 9:54















                                          0














                                          Try this @Mark.I got the scroll you showed in the Video



                                          <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">
                                          <android.support.design.widget.AppBarLayout
                                          android:id="@+id/app_bar"
                                          android:layout_width="match_parent"
                                          android:layout_height="wrap_content">

                                          <android.support.design.widget.CollapsingToolbarLayout
                                          android:layout_width="match_parent"
                                          android:layout_height="wrap_content"
                                          app:layout_scrollFlags="scroll|enterAlways|exitUntilCollapsed">

                                          <TextView
                                          android:layout_width="match_parent"
                                          android:layout_height="145dp"
                                          android:layout_marginTop="56dp"
                                          android:background="#444"
                                          android:gravity="center"
                                          android:text="ImageView"
                                          android:textColor="@android:color/white"
                                          android:textSize="20sp"
                                          app:layout_collapseMode="parallax" />

                                          <TextView
                                          android:layout_width="match_parent"
                                          android:layout_height="56dp"
                                          android:background="#ff8000"
                                          android:gravity="center_vertical"
                                          android:paddingStart="16dp"
                                          android:paddingEnd="16dp"
                                          android:text="Top bar"
                                          android:textColor="@android:color/white"
                                          app:layout_collapseMode="pin" />

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

                                          <TextView
                                          android:layout_width="match_parent"
                                          android:layout_height="50dp"
                                          android:background="#ddd"
                                          android:gravity="center_vertical"
                                          android:paddingStart="16dp"
                                          android:paddingEnd="16dp"
                                          android:text="Bottom bar"
                                          android:textColor="@android:color/black"
                                          app:layout_scrollFlags="enterAlways" />
                                          </android.support.design.widget.AppBarLayout>


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

                                          <include layout="@layout/content_scrolling"/>

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





                                          share|improve this answer























                                          • The image still appears immediately when you start scrolling up again. It should only show up when the user is back at the top.

                                            – Mark Buikema
                                            Mar 25 at 8:37











                                          • So you want the image to be hidden when the user scrolls up? @MarkBuikema

                                            – g.brahma Datta
                                            Mar 25 at 8:56











                                          • Yes, the image should be hidden until the user has scrolled all the way to the top

                                            – Mark Buikema
                                            Mar 25 at 8:57











                                          • I have made the feature the same as the video. The image won't appear until the top view completely visible to the user. After it is visible then image view will appear. Or am I missing something?@MarkBuikema.I can record the feature if you want?

                                            – g.brahma Datta
                                            Mar 25 at 9:18












                                          • I have answered my own question, check it out. The image should not appear until the list is at the top.

                                            – Mark Buikema
                                            Mar 25 at 9:54













                                          0












                                          0








                                          0







                                          Try this @Mark.I got the scroll you showed in the Video



                                          <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">
                                          <android.support.design.widget.AppBarLayout
                                          android:id="@+id/app_bar"
                                          android:layout_width="match_parent"
                                          android:layout_height="wrap_content">

                                          <android.support.design.widget.CollapsingToolbarLayout
                                          android:layout_width="match_parent"
                                          android:layout_height="wrap_content"
                                          app:layout_scrollFlags="scroll|enterAlways|exitUntilCollapsed">

                                          <TextView
                                          android:layout_width="match_parent"
                                          android:layout_height="145dp"
                                          android:layout_marginTop="56dp"
                                          android:background="#444"
                                          android:gravity="center"
                                          android:text="ImageView"
                                          android:textColor="@android:color/white"
                                          android:textSize="20sp"
                                          app:layout_collapseMode="parallax" />

                                          <TextView
                                          android:layout_width="match_parent"
                                          android:layout_height="56dp"
                                          android:background="#ff8000"
                                          android:gravity="center_vertical"
                                          android:paddingStart="16dp"
                                          android:paddingEnd="16dp"
                                          android:text="Top bar"
                                          android:textColor="@android:color/white"
                                          app:layout_collapseMode="pin" />

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

                                          <TextView
                                          android:layout_width="match_parent"
                                          android:layout_height="50dp"
                                          android:background="#ddd"
                                          android:gravity="center_vertical"
                                          android:paddingStart="16dp"
                                          android:paddingEnd="16dp"
                                          android:text="Bottom bar"
                                          android:textColor="@android:color/black"
                                          app:layout_scrollFlags="enterAlways" />
                                          </android.support.design.widget.AppBarLayout>


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

                                          <include layout="@layout/content_scrolling"/>

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





                                          share|improve this answer













                                          Try this @Mark.I got the scroll you showed in the Video



                                          <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">
                                          <android.support.design.widget.AppBarLayout
                                          android:id="@+id/app_bar"
                                          android:layout_width="match_parent"
                                          android:layout_height="wrap_content">

                                          <android.support.design.widget.CollapsingToolbarLayout
                                          android:layout_width="match_parent"
                                          android:layout_height="wrap_content"
                                          app:layout_scrollFlags="scroll|enterAlways|exitUntilCollapsed">

                                          <TextView
                                          android:layout_width="match_parent"
                                          android:layout_height="145dp"
                                          android:layout_marginTop="56dp"
                                          android:background="#444"
                                          android:gravity="center"
                                          android:text="ImageView"
                                          android:textColor="@android:color/white"
                                          android:textSize="20sp"
                                          app:layout_collapseMode="parallax" />

                                          <TextView
                                          android:layout_width="match_parent"
                                          android:layout_height="56dp"
                                          android:background="#ff8000"
                                          android:gravity="center_vertical"
                                          android:paddingStart="16dp"
                                          android:paddingEnd="16dp"
                                          android:text="Top bar"
                                          android:textColor="@android:color/white"
                                          app:layout_collapseMode="pin" />

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

                                          <TextView
                                          android:layout_width="match_parent"
                                          android:layout_height="50dp"
                                          android:background="#ddd"
                                          android:gravity="center_vertical"
                                          android:paddingStart="16dp"
                                          android:paddingEnd="16dp"
                                          android:text="Bottom bar"
                                          android:textColor="@android:color/black"
                                          app:layout_scrollFlags="enterAlways" />
                                          </android.support.design.widget.AppBarLayout>


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

                                          <include layout="@layout/content_scrolling"/>

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






                                          share|improve this answer












                                          share|improve this answer



                                          share|improve this answer










                                          answered Mar 25 at 7:19









                                          g.brahma Dattag.brahma Datta

                                          419411




                                          419411












                                          • The image still appears immediately when you start scrolling up again. It should only show up when the user is back at the top.

                                            – Mark Buikema
                                            Mar 25 at 8:37











                                          • So you want the image to be hidden when the user scrolls up? @MarkBuikema

                                            – g.brahma Datta
                                            Mar 25 at 8:56











                                          • Yes, the image should be hidden until the user has scrolled all the way to the top

                                            – Mark Buikema
                                            Mar 25 at 8:57











                                          • I have made the feature the same as the video. The image won't appear until the top view completely visible to the user. After it is visible then image view will appear. Or am I missing something?@MarkBuikema.I can record the feature if you want?

                                            – g.brahma Datta
                                            Mar 25 at 9:18












                                          • I have answered my own question, check it out. The image should not appear until the list is at the top.

                                            – Mark Buikema
                                            Mar 25 at 9:54

















                                          • The image still appears immediately when you start scrolling up again. It should only show up when the user is back at the top.

                                            – Mark Buikema
                                            Mar 25 at 8:37











                                          • So you want the image to be hidden when the user scrolls up? @MarkBuikema

                                            – g.brahma Datta
                                            Mar 25 at 8:56











                                          • Yes, the image should be hidden until the user has scrolled all the way to the top

                                            – Mark Buikema
                                            Mar 25 at 8:57











                                          • I have made the feature the same as the video. The image won't appear until the top view completely visible to the user. After it is visible then image view will appear. Or am I missing something?@MarkBuikema.I can record the feature if you want?

                                            – g.brahma Datta
                                            Mar 25 at 9:18












                                          • I have answered my own question, check it out. The image should not appear until the list is at the top.

                                            – Mark Buikema
                                            Mar 25 at 9:54
















                                          The image still appears immediately when you start scrolling up again. It should only show up when the user is back at the top.

                                          – Mark Buikema
                                          Mar 25 at 8:37





                                          The image still appears immediately when you start scrolling up again. It should only show up when the user is back at the top.

                                          – Mark Buikema
                                          Mar 25 at 8:37













                                          So you want the image to be hidden when the user scrolls up? @MarkBuikema

                                          – g.brahma Datta
                                          Mar 25 at 8:56





                                          So you want the image to be hidden when the user scrolls up? @MarkBuikema

                                          – g.brahma Datta
                                          Mar 25 at 8:56













                                          Yes, the image should be hidden until the user has scrolled all the way to the top

                                          – Mark Buikema
                                          Mar 25 at 8:57





                                          Yes, the image should be hidden until the user has scrolled all the way to the top

                                          – Mark Buikema
                                          Mar 25 at 8:57













                                          I have made the feature the same as the video. The image won't appear until the top view completely visible to the user. After it is visible then image view will appear. Or am I missing something?@MarkBuikema.I can record the feature if you want?

                                          – g.brahma Datta
                                          Mar 25 at 9:18






                                          I have made the feature the same as the video. The image won't appear until the top view completely visible to the user. After it is visible then image view will appear. Or am I missing something?@MarkBuikema.I can record the feature if you want?

                                          – g.brahma Datta
                                          Mar 25 at 9:18














                                          I have answered my own question, check it out. The image should not appear until the list is at the top.

                                          – Mark Buikema
                                          Mar 25 at 9:54





                                          I have answered my own question, check it out. The image should not appear until the list is at the top.

                                          – Mark Buikema
                                          Mar 25 at 9:54











                                          0














                                          There are lots of effects on the scrolling behavior that can be achieved by setting different layout_scrollFlags. In your case, I think the flag you want is enterAlwaysCollapsed. Add the flag along with enterAlways instead of replacing all the flags.



                                          scroll will make the toolbar scroll like the rest of the content, enterAlways will make the toolbar AND the rest of the CollapsingToolbarLayout to pop back immediately after scroll up, whereas enterAlwaysCollapsed only expands the CollapsingToolbarLayout after the page is scrolled all the way to the top.



                                          Here's the effect that enterAlwaysCollapsed achieves.






                                          share|improve this answer





























                                            0














                                            There are lots of effects on the scrolling behavior that can be achieved by setting different layout_scrollFlags. In your case, I think the flag you want is enterAlwaysCollapsed. Add the flag along with enterAlways instead of replacing all the flags.



                                            scroll will make the toolbar scroll like the rest of the content, enterAlways will make the toolbar AND the rest of the CollapsingToolbarLayout to pop back immediately after scroll up, whereas enterAlwaysCollapsed only expands the CollapsingToolbarLayout after the page is scrolled all the way to the top.



                                            Here's the effect that enterAlwaysCollapsed achieves.






                                            share|improve this answer



























                                              0












                                              0








                                              0







                                              There are lots of effects on the scrolling behavior that can be achieved by setting different layout_scrollFlags. In your case, I think the flag you want is enterAlwaysCollapsed. Add the flag along with enterAlways instead of replacing all the flags.



                                              scroll will make the toolbar scroll like the rest of the content, enterAlways will make the toolbar AND the rest of the CollapsingToolbarLayout to pop back immediately after scroll up, whereas enterAlwaysCollapsed only expands the CollapsingToolbarLayout after the page is scrolled all the way to the top.



                                              Here's the effect that enterAlwaysCollapsed achieves.






                                              share|improve this answer















                                              There are lots of effects on the scrolling behavior that can be achieved by setting different layout_scrollFlags. In your case, I think the flag you want is enterAlwaysCollapsed. Add the flag along with enterAlways instead of replacing all the flags.



                                              scroll will make the toolbar scroll like the rest of the content, enterAlways will make the toolbar AND the rest of the CollapsingToolbarLayout to pop back immediately after scroll up, whereas enterAlwaysCollapsed only expands the CollapsingToolbarLayout after the page is scrolled all the way to the top.



                                              Here's the effect that enterAlwaysCollapsed achieves.







                                              share|improve this answer














                                              share|improve this answer



                                              share|improve this answer








                                              edited Mar 27 at 4:05

























                                              answered Mar 24 at 19:29









                                              jackz314jackz314

                                              1,080425




                                              1,080425



























                                                  draft saved

                                                  draft discarded
















































                                                  Thanks for contributing an answer to Stack Overflow!


                                                  • Please be sure to answer the question. Provide details and share your research!

                                                  But avoid


                                                  • Asking for help, clarification, or responding to other answers.

                                                  • Making statements based on opinion; back them up with references or personal experience.

                                                  To learn more, see our tips on writing great answers.




                                                  draft saved


                                                  draft discarded














                                                  StackExchange.ready(
                                                  function ()
                                                  StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55303420%2fcollapsingtoolbarlayout-expand-only-when-at-the-top%23new-answer', 'question_page');

                                                  );

                                                  Post as a guest















                                                  Required, but never shown





















































                                                  Required, but never shown














                                                  Required, but never shown












                                                  Required, but never shown







                                                  Required, but never shown

































                                                  Required, but never shown














                                                  Required, but never shown












                                                  Required, but never shown







                                                  Required, but never shown







                                                  Popular posts from this blog

                                                  Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                                                  Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                                                  Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript