Android状态栏颜色
当我使用android:fitsSystemWindows=“false” 它变得透明。我不希望这种事发生。我希望它的颜色为Android状态栏颜色,android,xml,android-fragments,Android,Xml,Android Fragments,当我使用android:fitsSystemWindows=“false” 它变得透明。我不希望这种事发生。我希望它的颜色为colorPrimaryDark 我必须将其设置为false,因为我在主布局中使用了FrameLayout,这样我可以在设置android:fitsystemwindows=“false”时膨胀覆盖碎片,覆盖占据整个屏幕,我不希望覆盖碎片发生这种情况 我的主要活动是这样的 <?xml version="1.0" encoding="utf-8"?> <an
colorPrimaryDark
我必须将其设置为false
,因为我在主布局中使用了FrameLayout
,这样我可以在设置android:fitsystemwindows=“false”
时膨胀覆盖碎片,覆盖占据整个屏幕,我不希望覆盖碎片发生这种情况
我的主要活动是这样的
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:background="@drawable/layout_bg_white"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="false"
tools:openDrawer="start"
tools:context="com.example.tabstrial2.MainActivity">
<RelativeLayout
android:id="@+id/main_layout_of_app"
android:layout_width="match_parent"
android:layout_height="match_parent">
</RelativeLayout>
<FrameLayout
android:id="@+id/overlay_fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="56dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="119dp" />
</android.support.v4.widget.DrawerLayout>
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#500347</item>
<item name="colorPrimaryDark">#862b7b</item>
<item name="colorAccent">#1a2fcf</item>
<item name="android:textColor">#ffffff</item>
<item name="colorControlHighlight">#fff</item>
<item name="colorControlActivated">@android:color/holo_green_dark</item>
<item name="colorControlNormal">#fff</item> <!-- normal border color change as you wish -->
<item name="colorButtonNormal">#500347</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<style name="AppTheme.Picker" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:textColorPrimary">@android:color/white</item>
</style>
<!--<style name="AppTheme.CheckBox" parent="Theme.AppCompat.Light.NoActionBar">-->
<!--<item name="android:colorAccent">@android:color/white</item>-->
<!--</style>-->
<style name="MyCheckBox" parent="Theme.AppCompat.NoActionBar">
<item name="colorControlNormal">#fff
</item> <!-- normal border color change as you wish -->
<item name="colorControlActivated">#fff</item> <!-- activated color change as you wish -->
<item name="android:textColor">#FFFF3F3C</item> <!-- checkbox text color -->
</style>
style.xml如下所示
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:background="@drawable/layout_bg_white"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="false"
tools:openDrawer="start"
tools:context="com.example.tabstrial2.MainActivity">
<RelativeLayout
android:id="@+id/main_layout_of_app"
android:layout_width="match_parent"
android:layout_height="match_parent">
</RelativeLayout>
<FrameLayout
android:id="@+id/overlay_fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="56dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="119dp" />
</android.support.v4.widget.DrawerLayout>
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#500347</item>
<item name="colorPrimaryDark">#862b7b</item>
<item name="colorAccent">#1a2fcf</item>
<item name="android:textColor">#ffffff</item>
<item name="colorControlHighlight">#fff</item>
<item name="colorControlActivated">@android:color/holo_green_dark</item>
<item name="colorControlNormal">#fff</item> <!-- normal border color change as you wish -->
<item name="colorButtonNormal">#500347</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<style name="AppTheme.Picker" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:textColorPrimary">@android:color/white</item>
</style>
<!--<style name="AppTheme.CheckBox" parent="Theme.AppCompat.Light.NoActionBar">-->
<!--<item name="android:colorAccent">@android:color/white</item>-->
<!--</style>-->
<style name="MyCheckBox" parent="Theme.AppCompat.NoActionBar">
<item name="colorControlNormal">#fff
</item> <!-- normal border color change as you wish -->
<item name="colorControlActivated">#fff</item> <!-- activated color change as you wish -->
<item name="android:textColor">#FFFF3F3C</item> <!-- checkbox text color -->
</style>
#500347
#862b7b
#1a2fcf
#ffffff
#fff
@安卓:彩色/全息绿/深色
#fff
#500347
假的
真的
@android:彩色/白色
#fff
#fff
#FF3F3C
您可以尝试将状态栏颜色设置为显式
<item name="android:statusBarColor">@color/color_primary_dark</item>
@color/color\u primary\u深色
或者将半透明状态设置为false
<item name="android:windowTranslucentStatus">false</item>
false
您可以尝试将状态栏颜色设置为显式
<item name="android:statusBarColor">@color/color_primary_dark</item>
@color/color\u primary\u深色
或者将半透明状态设置为false
<item name="android:windowTranslucentStatus">false</item>
false
在setcontentview(…)下面的活动中
在setcontentview下方的活动中(…)
显示您的主题用于activity@MujammilAhamed,添加了有问题的style.xml,请看一看。只需按照本教程()进行操作,可能会对您有所帮助。显示用于activity@MujammilAhamed,添加了有问题的style.xml,请看一看。只需按照本教程()进行操作,可能会对您有所帮助。请尝试
false
Nope,同样,它只在19 API以上有效。阿里·塔乌尼的回答对我很有效。试试false
no,同样它只在19 API以上有效。阿里·塔乌尼的回答对我有用。谢谢。如果android版本低于棒棒糖,会发生什么?那么状态栏的颜色是什么?很抱歉,我会检查自己,但我无法在我的电脑配置上运行emulator。@BhushanBabar尝试安装emulator与LOLLIPOP+一起工作,如果版本小于LOLLIPOP,则颜色将为黑色,默认颜色。感谢分享@Ali Taouni。。我查了很多答案这是非常清楚的一个。。如果你是汉克,请检查这个。如果android版本低于棒棒糖,会发生什么?那么状态栏的颜色是什么?很抱歉,我会检查自己,但我无法在我的电脑配置上运行emulator。@BhushanBabar尝试安装emulator与LOLLIPOP+一起工作,如果版本小于LOLLIPOP,则颜色将为黑色,默认颜色。感谢分享@Ali Taouni。。我查了很多答案这是非常清楚的一个。。如果可以,请检查这个