透明状态栏我使用的方式https://stackoverflow.com/a/27051852/3875363实现状态栏后面的抽屉展示片段,它似乎很动听前只停留了一个视图。上隐藏后底部奇怪填充和使用DrawerLayout
但我面临着一个奇怪的情况后,我隐藏和显示这个片段,一个白色填充出现在drawerlayout的底部,它喜欢在下面。
我的评论最代码显示一个简单的例子。
活动的布局:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/content_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
</FrameLayout>
片段与抽屉
<android.support.v4.widget.DrawerLayout android:id="@+id/drawer_layout"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".MainActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<include
android:id="@+id/action_bar_in_list"
layout = "@layout/toolbar"/>
</RelativeLayout>
<com.ghostflying.portalwaitinglist.ScrimInsetsFrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/debug_content"
android:background="@color/setting_item_group_title_text"
app:insetForeground="#4000"
android:fitsSystemWindows="true"
android:layout_gravity="start"
android:layout_height="match_parent"
android:layout_width="@dimen/navigation_drawer_width">
</com.ghostflying.portalwaitinglist.ScrimInsetsFrameLayout>
</android.support.v4.widget.DrawerLayout>
所述第二片段的布局的布局:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- TODO: Update blank fragment layout -->
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/hello_blank_fragment"/>
</FrameLayout>
一旦我隐藏抽屉片段显示第二个片段,然后弹出返回堆栈返回。抽屉碎片看起来像图像,总是出现状态栏高度的填充。这么奇怪。
事实上,填充是全0dp,我评论大部分代码,看起来也很奇怪,我稍后会编辑这个问题。 – GhostFlying