2017-08-31 53 views
2

當我開始我的應用程序時,我得到了確切的狀態欄顏色,因爲我需要但當我做活動轉換我的狀態欄顏色變化,我不想要。我使用相同的技術在以前的項目中,這樣做很好,但在這裏我得到了不同的結論。究竟是什麼問題,這個問題怎麼解決?製作相同的狀態欄顏色的活動轉變

清單

<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> 

當應用程序開始Acticvity過渡 enter image description here

enter image description here 如何這個問題可以解決?

+0

檢查您的樣式,V21和張貼在這裏 –

+0

更新請 – Ghimire

+1

讓你style.xml文件夾價值觀和價值-21相同的文件夾刪除 – Shunishya

回答

1

在您的樣式V21請刪除

<item name="android:statusBarColor">@android:color/transparent</item> 
<! -- and add this --> 
<item name="android:statusBarColor">@color/colorPrimaryDark</item> 

並檢查輸出。

+0

多年平均值help.same結果 – Ghimire

+0

檢查更新的答案 –

+0

相同的結果隊友 – Ghimire