【问题标题】:Hide Android navigation bar in Appcelerator Titanium在 Appcelerator Titanium 中隐藏 Android 导航栏
【发布时间】:2017-02-14 15:12:38
【问题描述】:

我正在 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"
});

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

【问题讨论】:

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


【解决方案1】:

将这个添加到 tss 以隐藏 android 上的导航栏

"Window[platform=android]": {
    theme: "Theme.AppCompat.NoTitleBar"
}

【讨论】:

  • 我有:myApp.window = Ti.UI.createWindow({ backgroundColor: 'white', theme: "Theme.AppCompat.NoTitleBar" });它也不起作用。
  • 试试:theme: Theme.AppCompat.Translucent.NoTitleBar
  • 您是否在 tiapp 中指定了主题?尝试删除 tiapp 中的所有主题引用
【解决方案2】:

您的源代码看起来像是在使用 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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-06
    • 2017-07-23
    • 1970-01-01
    相关资源
    最近更新 更多