Last active
August 14, 2019 13:58
-
-
Save chandruscm/03756a5ca3ba520d828615453de414d4 to your computer and use it in GitHub Desktop.
activity_menu_app_bar_1.xml produces the desired effect, but the toolbar moves up: as per the height set in the empty CollapsingToolbarLayout before adding the elevation. activity_menu_app_bar_2.xml does not work, it adds elevation by default without scrolling.
try
<CoordinatorLayout>
<AppBarLayout>
<Toolbar />
<android.support.v4.widget.Space
android:layout_width="0dp"
android:layout_height="1px"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
android:minHeight="0px" />
</AppBarLayout>
...
</CoordinatorLayout>
You'll get a 1px "collapse" but the Toolbar above won't move.
For some reason, it works only when I place the Space
above the Toolbar
and that again moves the Toolbar
. Placing the Space
below the Toolbar
does not set any elevation at all. I tested it on a device and the emulator, both on API 25.
I enabled layout bounds
and I noticed the Space
wasn't collapsing, it stays at the bottom. I also tried wrapping the Toolbar
and Space
in a vertical linear layout and tried using a plain View
instead of Space
. But no luck :(
Say, why does AppBarLayout have a default stateListAnimator ? When does it ever get changed? Which states does it have, by default?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
activity_menu_app_bar_1.xml
produces the desired effect, but the toolbar moves up: as per theheight
set in the empty CollapsingToolbarLayout before adding the elevation.activity_menu_app_bar_2.xml
does not work, it adds elevation by default without scrolling.