我无法同时应用 "Theme.AppCompat.NoTitleBar" 和 "colorPrimaryDark" 状态栏颜色 属性

i am unable to apply "Theme.AppCompat.NoTitleBar" and "colorPrimaryDark" status bar color property at the same time

我想在整个应用程序中隐藏操作栏,还想设置状态栏颜色?在 Appcelerator 钛中。

试试这个 code.May 它会对你有所帮助。 -

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            getWindow().setStatusBarColor(getResources().getColor(R.color.color_name));
        }

请按照 https://wiki.appcelerator.org/display/guides2/Android+Action+Bar

上的官方指南进行操作

您可以在打开事件的代码 win.activity.actionBar.hide(); 中隐藏它并在主题 xml 中使用普通样式,或者您将主题中的父级设置为 <style name="Theme.MyTheme" parent="Theme.AppCompat.NoTitleBar">.

状态栏颜色是一个主题项: <item name="android:statusBarColor">#ff0000</item>。您可以添加到您的主题中。

这是我用作示例的样式:

<style name="Theme.MyTheme" parent="Theme.AppCompat.NoTitleBar">
    <item name="colorPrimary">#212121</item>
    <item name="colorPrimaryDark">#000000</item>
    <item name="android:statusBarColor">#00d59e</item>
    <item name="colorAccent">#ff225c</item>
    <item name="android:textColorHint">#999999</item>
</style>

使用

"Window" : {
    theme: "Theme.MyTheme",
    barColor: "#ff225c"
}

我将我的自定义主题文件保存在里面

App->Platform->Android->res->values->mytheme.xml

我的 xml 文件如下所示,对我来说效果很好..

 <resources>
    <style name="Theme.MyTheme" parent="Theme.AppCompat.NoTitleBar.Fullscreen">
        <item name="buttonStyle">@style/MyButton</item>
    </style>
    <style name="MyButton" parent="Widget.AppCompat.Button">
        <item name="android:textAllCaps">false</item>
    </style>
</resources>

并且在 tiapp.xml 文件中 maifest

<application android:theme="@style/Theme.MyTheme"/>