修复使用android设计库appbar/toolbar时混乱的系统栏色调
Q:如何使系统栏的颜色正确? 我已经试着按照下面的步骤设置了这个 在执行此操作时,他们使用协调器布局和包含工具栏布局的appbar布局,如下所示: 然后,我尝试移除协调器布局和应用程序栏,并在其中创建一个带有工具栏和嵌套滚动视图的LinearLayout,如下所示: 正如你可能知道的,它看起来不太正确。使用导航抽屉布局,状态栏与工具栏颜色相同,效果非常好 我还尝试过摆弄修复使用android设计库appbar/toolbar时混乱的系统栏色调,android,android-layout,android-design-library,Android,Android Layout,Android Design Library,Q:如何使系统栏的颜色正确? 我已经试着按照下面的步骤设置了这个 在执行此操作时,他们使用协调器布局和包含工具栏布局的appbar布局,如下所示: 然后,我尝试移除协调器布局和应用程序栏,并在其中创建一个带有工具栏和嵌套滚动视图的LinearLayout,如下所示: 正如你可能知道的,它看起来不太正确。使用导航抽屉布局,状态栏与工具栏颜色相同,效果非常好 我还尝试过摆弄fitsystemwindows,但没有效果 Q:如何使系统栏的颜色正确? 我想我听说这可能是设计库中的一个bug,所以现在
fitsystemwindows
,但没有效果
Q:如何使系统栏的颜色正确?
我想我听说这可能是设计库中的一个bug,所以现在可能有一个解决方法
这是我的布局代码:
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/fixed_scroll_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingTop="24dp">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/card_margin">
<LinearLayout
style="@style/Widget.CardContent"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Info"
android:textAppearance="@style/TextAppearance.AppCompat.Title" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="blank text for now" />
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
My style-v21主题包含:
@android:color/transparent
删除该选项修复了问题。您可以包含您的主题吗
colorPrimaryDark
应该足够了。该死的,愚蠢的问题。在我的主题的styles-v21版本中有@android:color/transparent
。