我想隐藏整个应用程序的操作栏,并要设置状态栏的颜色?在Appcelerator的钛。
请按照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>
并在里面maifest tiapp.xml文件
<application android:theme="@style/Theme.MyTheme"/>
试试这个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));
}