使用windowTranslucentStatus与CollapsingToolbarLayout
- 论坛
- 使用windowTranslucentStatus与CollapsingToolbarLayout
6 浏览
使用windowTranslucentStatus与CollapsingToolbarLayout
我试图实现类似于Google Play上所见的效果。
我有以下布局来显示一个带有背景图像的透明工具栏。当用户滚动时,图像视图会产生视差效果,因为它滚动到屏幕外。当用户向上滚动时,工具栏会返回,只有当用户滚动到列表顶部时,图像视图才返回。
这一切都很好地运行。
问题
当我将windowTranslucentStatus设置为true时。
视图中的内容会向上移动到状态栏下方,但CollapsingToolbarLayout的内容会向上移动两倍的状态栏高度(CollapsingToolbarLayout保持正确的高度)。
这意味着图像的顶部被切掉了一部分,操作栏现在出现在状态栏下方而不是下方。由于这个副作用,CollapsingToolbarLayout底部现在有与状态栏相同高度的填充。
这是没有设置windowTranslucentStatus时的效果。这里一切都正常
设置windowTranslucentStatus为true
用户从列表底部向上滚动(不在顶部)