[英]Show Toolbar shadow only on scroll in CoordinatorLayout
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 (ie after the fragment is created it should not show a shadow until the user starts scrolling down a list). 我想知道如何在CoordinatorLayout中使用工具栏/ CollapsingToolbarLayout仅在内容在其下滚动时显示阴影而不是其他方式(即在创建片段之后,它不应显示阴影,直到用户开始向下滚动列表)。 Preferably with just XML 最好只用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..) (我认为我不需要AppBarLayout,因为工具栏的大小是固定的,不需要调整大小或视差效果等。)
Any help with this is much appreciated 对此有任何帮助非常感谢
You can try setting elevation of the toolbar. 您可以尝试设置工具栏的高程。 0 elevation means no shadow. 0高程表示没有阴影。
toolbar.setElevation(int)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.