appcelerator titanium - hide navigation bar android

前端 未结 1 556
轮回少年
轮回少年 2021-01-29 04:20

Is it possible to hide permanently the Android bottom navigation in Appcelerator Titanium? Many questions about this subject but no fine solutions.



        
相关标签:
1条回答
  • 2021-01-29 04:31

    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?

    0 讨论(0)
提交回复
热议问题