当我启动我的应用程序时,我得到了我需要的确切状态栏颜色,但是当我进行活动转换时,我的状态栏颜色发生变化,这是我不想要的。我在之前的项目中使用相同的技术,这很顺利但在这里我变得与众不同。这是什么问题,如何解决这个问题?
清单
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.municipality.mobile.patanheritage">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/facebook_app_id" />
<activity
android:name=".activity.Splash"
android:hardwareAccelerated="false">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".activity.Home" />
<activity android:name=".activity.PopularDestination" />
<activity android:name=".activity.PopularDestinationGridDetail" />
<activity android:name=".activity.EventsAndFestivals" />
<activity android:name=".activity.EventAndFestivalGridDetail" />
<activity android:name=".activity.HireGuideForm" />
<activity android:name=".activity.HomeStayDetailPage" />
<activity android:name=".activity.Rate_And_Review" />
<activity android:name=".activity.Information" />
<activity android:name=".activity.AboutHelp" />
<activity android:name=".activity.AboutPrivacyPolicy" />
<activity android:name=".activity.AboutTermsOfUse" />
<activity android:name=".activity.DeveloperInfo" />
<activity android:name=".activity.ContactMenu" />
</application>
</manifest>
式
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat">
<item name="android:colorBackground">@color/menu_background</item>
<item name="android:textColor">@color/menu_text_color</item>
<item name="android:textSize">16sp</item>
<item name="android:layout_marginBottom">02dp</item>
</style>
<style name="RatingBar" parent="Theme.AppCompat">
<item name="colorControlNormal">@color/color_yellow</item>
</style>
</resources>
颜色
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#53A9B6</color>
<color name="colorPrimaryDark">#007C88</color>
<color name="colorAccent">#FF4081</color>
<color name="windoebackground">#FFFFFF</color>
<color name="menu_background">#262626</color>
<color name="menu_text_color">#FFFFFF</color>
<color name="color_yellow">#FFC000</color>
</resources>
V21
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="windowActionBar">false</item>
<item name="windowActionModeOverlay">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowTranslucentStatus">true</item>
</style>
</resources>
应用启动时
如何解决这个问题?
答案 0 :(得分:2)
在你的风格v21中,请删除
<item name="android:statusBarColor">@android:color/transparent</item>
<! -- and add this -->
<item name="android:statusBarColor">@color/colorPrimaryDark</item>
并检查输出。