禁用 CollapsingToolbarLayout 高程

Disable CollapsingToolbarLayout elevation

我正在使用 this answer 中的代码。我试图在折叠时禁用工具栏的提升。我尝试将 android:elevation="0dp" 放入所有 xml 标签,但没有成功。有什么建议吗?

AppBarLayout 上设置 app:elevation="0dp" 即可。

只需添加

android:stateListAnimator="@null"

给你的AppBarLayout