Can't hide titlebar Titanium with Alloy

余生颓废 提交于 2019-12-10 18:25:13

问题


I have encounterd a problem in Titanium Appcelerator using Alloy MVC. This problem contains the following(see image)

I can't remove the black bar where the app name and logo is found. I am running the app on a device(Google Nexus, no simulator)

I have tried the following to remove this:

XML:

<Alloy>
    <Window>
    </Window>
</Alloy>

TSS:

"Window":
{
    navBarHidden:true,
    fullscreen:true,
    backgroundColor:"Orange",
    orientationModes:[Ti.UI.PORTRAIT],
}

TiApp.XML:

<statusbar-style>default</statusbar-style>
<statusbar-hidden>true</statusbar-hidden>
<fullscreen>true</fullscreen>
<navbar-hidden>true</navbar-hidden>

But none of these options are working to hide this black bar. In the iOS simulator it does remove the navigation bar by only setting the property fullscreen to true

Are there other options to get this away? Thanks in advance!


回答1:


Is it the ActionBar that's showing perhaps? Try hiding it.

To modify the theme to hide the action bar:

  1. Add a custom theme file to your project:

platform/android/res/values/custom_theme.xml:

<?xml version="1.0" encoding="utf-8"?> <resources>
    <style name="Theme.NoActionBar" parent="@style/Theme.Titanium">
        <!-- Depending on the parent theme, this may be called android:windowActionBar instead of windowActionBar -->
        <item name="windowActionBar">false</item>
    </style> </resources>

Taken from: http://docs.appcelerator.com/titanium/3.0/#!/guide/Android_Action_Bar




回答2:


If you're using Titanium SDK 3.3.0, the Titanium theme, which is one of the default themes, now hides the action and status bar. To use it, just add this to your tiapp.xml.

<android xmlns:android="http://schemas.android.com/apk/res/android">
    <manifest>
        <application android:theme="@style/Theme.Titanium"/>
    </manifest>
</android>

You can read more about this and other themes that Titanium has for Android here: Android Themes.




回答3:


I just added the code below in my TiApp.xml to hide the action bar that is where the name of my app and logo of Titanium were

<android xmlns:android="http://schemas.android.com/apk/res/android">
    <manifest>
    <application android:theme="@style/Theme.Titanium"/>
</manifest>

You can hide the status bar too (where the clock, battery level, notifications, etc. are) by adding the statusbar line

<fullscreen>false</fullscreen>
<statusbar-hidden>true</statusbar-hidden>
<analytics>true</analytics>


来源:https://stackoverflow.com/questions/25184794/cant-hide-titlebar-titanium-with-alloy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!