appcelerator titanium - hide navigation bar android

久未见 提交于 2019-12-02 11:23:07
Ricardo Pereira

This method always worked for me, set the app to fullscreen without nav bar and tab bar.

Assuming your main Window's id is not set or is set to 'index', only this should work, it's the approach that you've tried:

$.index.addEventListener('open', function(e) {

    $.index.activity.actionBar.hide();
});

In your app.tss or index.tss:

"Window":{
    navBarHidden:true,
    tabBarHidden:true,
    fullscreen:true
}

In your tiapp.xml:

<fullscreen>true</fullscreen>
<navbar-hidden>true</navbar-hidden>

If the issue it still the same, try to add this (specify theme) to the application or activity tags of the manifest section inside the tiapp.xml:

android:theme="@style/Theme.NoActionBar"

Additional Info:

app.tss: global styles
index.tss: style for the index view

Verify if the id of the Window is correct, if there is any style overwriting the pretended one.

Add a console.log inside the window open method, you could check if exists all the action bar references:

if($.index) {

    console.log("window");

    if($.index.activity) {

        console.log("activity");

        if($.index.activity.actionBar) {

            console.log("action bar");

            if($.index.activity.actionBar.hide) {

                console.log("hide - try to hide");

                $.index.activity.actionBar.hide();
            }
        }
    }
}

Check out this article at the Appcelerator Blog: Hiding the Android ActionBar

If you're trying to hide the Soft Navigation Bar, I don't know it Titanium SDK as that option, but once I've answered a question, like yours, and Fokke Zandbergen comment this:

What you want is possible since Titanium 5.2 by using <fullscreen>true</fullscreen> in tiapp.xml.  

Android Documentation: Using Immersive Full-Screen Mode

Appcelerator Documentation: Hide Soft Navigation Bar

If all of this doesn't work you could try the following module:

Appcelerator Module - Marketplace (free): Immersive view

Also found in the other question: How to hide the soft navigation bar on Android with Titanium?

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