使用colorPrimaryDark更改状态栏的颜色不起作用

问题描述

因此,我正在尝试更改状态栏的颜色,但是由于某些原因,它不起作用。我的API级别为29。color.xml文件中的所有颜色均不起作用。这是我的代码

styles.xml:

declare -i y=0
declare -i x=0
clear
echo "*"

function move {
    local inp key=
    while true ; do
        # Read (with timeout) input and store in key
        read -n1 -t0.30 inp && key=$inp

        # Move the cursor
       if [ "$key" = "d" ]; then let x++ ; fi
       if [ "$key" = "a" ]; then let x-- ; fi

       # Update screen
       tput clear
       tput cup $y $x; echo "*"

    # Remove: sleep 0.30s
    done
}

move

colors.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>
        <item name="android:windowContentTransitions">true</item>
    </style>
    <style name="tab_text" parent="@android:style/TextAppearance.Widget.TabWidget">
        <item name="android:fontFamily">@font/cerebrisans_medium</item>
    </style>

</resources>

当我从.DarkActionBar更改为.noActionBar时,启动画面活动出现错误。行:“ getSupportActionBar()。hide();”

<resources>
    <color name="colorPrimary">#008577</color>
    <color name="colorPrimaryDark">#03A9F4</color>
    <color name="colorAccent">#D81B60</color>
</resources>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)