appcelerator钛 - 隐藏导航栏android

时间:2016-11-08 11:53:13

标签: titanium appcelerator android-navigation-bar

是否可以永久隐藏Appcelerator Titanium中的Android底部导航?关于这个问题的许多问题,但没有很好的解决方案。

<fullscreen> true </fullscreen> 
in tiapp doesn't work with titanium 5.5.1

$.index.addEventListener('open', function(e) {   $.index.activity.actionBar.hide();}); 
doesn't work.

'Window':{navBarHidden:true,tabBarHidden:true,fullscreen:true} in tss 
doesn't work etc.

谢谢。

1 个答案:

答案 0 :(得分:0)

此方法始终适用于我,将应用程序设置为全屏,无需导航栏和标签栏。

假设你的主窗口的id没有设置或设置为'index',只有这个应该有效,这是你尝试过的方法:

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

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

在app.tss或index.tss中:

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

在你的tiapp.xml中:

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

如果问题仍然相同,请尝试将此(指定主题)添加到tiapp.xml内清单部分的应用程序或活动标记中:

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

其他信息:

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

验证窗口的ID是否正确,如果有任何样式覆盖了假装的那个。

在窗口open方法中添加console.log,您可以检查是否存在所有操作栏引用:

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();
            }
        }
    }
}

在Appcelerator博客上查看这篇文章:Hiding the Android ActionBar

如果你试图隐藏软导航栏,我不知道Titanium SDK是那个选项,但是一旦我回答了你的问题,Fokke Zandbergen就会对此发表评论:

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

如果所有这些都不起作用,您可以尝试以下模块:

Appcelerator Module - Marketplace (free): Immersive view

另见另一个问题:How to hide the soft navigation bar on Android with Titanium?

相关问题