隐藏Appcelerator Titanium中的Android导航栏

时间:2017-02-14 15:12:38

标签: android titanium appcelerator appcelerator-titanium appcelerator-mobile

我正在Appcelerator Titanium中创建应用程序。我想让它完全全屏,但我无法隐藏导航栏(后面,主页按钮)。我根据互联网上的信息做了一切,但它没有工作。

在tiapp.xml中:

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


/*** ........ ***/


<android xmlns:android="http://schemas.android.com/apk/res/android">
    <manifest android:versionCode="1" android:versionName="1.0">
        <application android:theme="@style/Theme.AppCompat.Translucent.NoTitleBar"/>
    </manifest>
</android>

窗口是这样创建的:

myApp.window = Ti.UI.createWindow({
    backgroundColor: 'white',
    theme: "Theme.AppCompat.NoTitleBar"
});

或者像这样:

myApp.window = Ti.UI.createWindow({
    backgroundColor: 'white',
    theme: "Theme.AppCompat.Translucent.NoTitleBar"
});

导航栏仍然可见。我错过了什么?

2 个答案:

答案 0 :(得分:0)

将此添加到tss以隐藏android

上的导航栏
"Window[platform=android]": {
    theme: "Theme.AppCompat.NoTitleBar"
}

答案 1 :(得分:0)

您的源代码看起来像是在使用Titanium Classic。您可以尝试以下内容:

if (Ti.Platform.name == 'android') {
    var theActionBar = null;

    myApp.window.addEventListener("open", function () {
        theActionBar = self.activity.actionBar;
        if (theActionBar != undefined) {
            theActionBar.hide();
        }
    });
}

这样做是为窗口打开事件添加一个监听器。如果调用windows open(),它会查找android actionBar并将其删除。只需在窗口声明下使用此代码即可。

希望这会有所帮助。 问候Dom

相关问题