5

I would like to know how I can use a Toolbar / CollapsingToolbarLayout in a CoordinatorLayout to show a shadow only when content is scrolled under it and not otherwise (i.e. after the fragment is created it should not show a shadow until the user starts scrolling down a list). Preferably with just XML

(I don't think I need a AppBarLayout here, since the size of the toolbar is fixed and does not need the resizing or parallax effects etc..)

Any help with this is much appreciated

Bootstrapper
  • 1,089
  • 3
  • 14
  • 33
  • Does this answer your question? [Android toolbar elevation when scrolling](https://stackoverflow.com/questions/35724308/android-toolbar-elevation-when-scrolling) – Brais Gabin Feb 11 '21 at 10:41

1 Answers1

0

You can try setting elevation of the toolbar. 0 elevation means no shadow.

toolbar.setElevation(int)

Shashwat
  • 172
  • 1
  • 10