Почему строка состояния возвращается к красному - PullRequest
0 голосов
/ 30 мая 2019

Итак, я установил несколько тем cosutome, одна из которых меняет цвет строки состояния на черный. Однако, когда фрагмент загружается, он снова становится красным, и я не могу понять, почему.

Manifest:

<application
    android:name=".ApplicationImpl"
    android:allowBackup="false"
    android:fullBackupContent="false"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:largeHeap="true"
    android:resizeableActivity="true"
    android:theme="@style/Theme.Blue"
    tools:replace="android:allowBackup,android:fullBackupContent"
    tools:ignore="GoogleAppIndexingWarning"
    tools:targetApi="n">

<activity
   android:name=".auth.LoginActivity"
   android:label="@string/title_activity_srlogin"
   android:launchMode="singleInstance"
   android:theme="@style/Theme.SR.Light"
   android:windowSoftInputMode="adjustResize|stateHidden" />

LoginFragment:

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
    val contextThemeWrapper = ContextThemeWrapper(activity, R.style.Theme_SR_Light)
    val tempInflater = inflater.cloneInContext(contextThemeWrapper)
    return tempInflater.inflate(R.layout.fragment_login, container, false)
}

Стили:

<style name="Theme.SR.Base.StatusBarBlack" parent="Theme.AppCompat.Light.NoActionBar"> 
    <item name="android:statusBarColor">@color/sr_black</item>
</style>


<style name="Theme.AppCompat.Light.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>

<style name="Theme.SR.Base" parent="Theme.AppCompat.Light.NoActionBar">
</style>

<style name="Theme.SR" parent="Theme.SR.Red"/> 

<style name="Theme.SR.Red" parent="Theme.SR.Base">
    <item name="colorPrimary">@color/redPrimaryColor</item>
    <item name="colorPrimaryDark">@color/redPrimaryDarkColor</item>
    <item name="colorAccent">@color/redAccentColor</item>
</style>


<style name="Theme.SR.Blue" parent="Theme.SR.Base">
    <item name="colorPrimary">@color/bluePrimaryColor</item>
    <item name="colorPrimaryDark">@color/bluePrimaryDarkColor</item>
    <item name="colorAccent">@color/blueAccentColor</item>
</style>

   <style name="Theme.SR.Light" parent="Theme.SR.Base.StatusBarBlack">
    <item name="colorPrimary">@color/sr_red</item>
    <item name="colorPrimaryDark">@color/sr_red_status_bar</item>
    <item name="colorAccent">@color/sr_red</item>
</style>

В чем я не прав?

...