Han*_*ans 5 android statusbar android-support-library android-collapsingtoolbarlayout
我正在开发一个小型的Android项目.我在显示状态栏下方的工具栏时遇到一些问题.我使用以下配置:
<CollapsingToolbarLayout fitSystemWindows="true" ...>
<FrameLayout fitSystemWindows="true" ...>
<ViewPager>
....consists a fragment with framelayout and image
</ViewPager>
<Toolbar fitSystemWindows="true" ...>
</FrameLayout>
<CollapsingToolbarLayout fitSystemWindows="true"...>
.....
</AppBarLayout>
</CoordinatorLayout>`
Run Code Online (Sandbox Code Playgroud)

<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/fragment_musicplayer_appBarlayout_test"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/fragment_musicexplorer_album_collapsingtoolbarlayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="#eab22b"
app:expandedTitleMarginStart="48dp"
app:expandedTitleMarginEnd="64dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_collapseMode="parallax"
android:fitsSystemWindows="true">
<android.support.v4.view.ViewPager
android:id="@+id/fragment_musicplayer_viewpager_test"
android:layout_width="match_parent"
android:layout_height="450dp" />
<android.support.v7.widget.Toolbar
android:id="@+id/fragment_musicplayer_toolbar_test"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@android:color/transparent"
android:fitsSystemWindows="true" />
</FrameLayout>
</android.support.design.widget.CollapsingToolbarLayout>
Run Code Online (Sandbox Code Playgroud)
如果你改变一些android:fitsSystemWindows="true"to android:fitsSystemWindows="false",它可能会起作用。
我在支持库版本23.2.0中遇到了与您类似的问题,然后搜索了 StackOverflow;找到了你的问题。
我的情况与你的情况相反,因为我的情况不需要上边距间距,但它需要。虽然我设置了android:fitsSystemWindows="false",但是什么都没有改变。
但我发现你设定了windowTranslucentStatus = true,我也设定了。这是一个关键线索。
我就敢android:fitsSystemWindows="false"改成android:fitsSystemWindows="true"。有效。
可能是行为android:fitsSystemWindows已经改变了。可能在 时已被颠倒windowTranslucentStatus = true。
——但是还有一个问题。当工具栏折叠时,工具栏的底部边界仍然错误对齐。我被迫放弃使用windowTranslucentStatus = true...
编辑:23.2.1已发布,底部边界问题已修复。但上述关于行为android:fitsSystemWindows已被颠倒的建议仍然是正确的。
| 归档时间: |
|
| 查看次数: |
2922 次 |
| 最近记录: |