出于某种原因,状态栏现在是白色的.或者更确切地说,一个白色的,另一个白色的阴影,在明亮的背景下隐约可见的图标.这是错误的,因为我的appbarlayout使用蓝色阴影作为其颜色.到目前为止,这一直很好,我不知道我做了什么导致这一点.我已经尝试手动将statusBarColor设置为colorPrimaryDark(#0277bd),但它无效.
我只是不知道为什么会发生这种情况.我正在粘贴我的活动的layout.xml,也许有人可以告诉我这里我做错了什么.
几点说明:
使用的主题尚未更改其默认值,即使用主要颜色设置.我把那些变成了我想要的正确的蓝色阴影,但是当我做了那个改变时,一切都在起作用.
我的layout.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
android:statusBarColor="@color/colorPrimaryDark"
tools:context=".activities.ContactsActivity">
<android.support.design.widget.AppBarLayout
android:id="@+id/contactsActivityAppbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:statusBarColor="@color/colorPrimaryDark"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/contactsActivityToolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/AppTheme.PopupOverlay"/>
<!-- app:layout_scrollFlags="scroll|enterAlways" -->
<android.support.design.widget.TabLayout
android:id="@+id/contactsActivityTabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabIndicatorColor="@android:color/white"
android:scrollbarStyle="insideOverlay"
android:paddingBottom="1dp"
android:background="@color/colorPrimary"/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/contactsTabsViewPager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)
colors.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#0288d1</color>
<color name="colorPrimaryDark">#0277bd</color>
<color name="colorAccent">#FF4081</color>
</resources>
Run Code Online (Sandbox Code Playgroud)
styles.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item> …Run Code Online (Sandbox Code Playgroud)