这种方法一直对我有用,将应用程序设置为全屏,没有导航栏和标签栏。
假设您的主窗口的 id 未设置或设置为“索引”,只有这样才能工作,这是您尝试过的方法:
$.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
验证 Window 的 id 是否正确,是否有任何样式覆盖了伪装的样式。
在窗口打开方法中添加一个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 博客中查看这篇文章:隐藏 Android ActionBar
如果您试图隐藏软导航栏,我不知道 Titanium SDK 作为该选项,但是一旦我回答了像您这样的问题,并且 Fokke Zandbergen 对此发表评论:
What you want is possible since Titanium 5.2 by using <fullscreen>true</fullscreen> in tiapp.xml.
Android 文档:使用沉浸式全屏模式
Appcelerator 文档:隐藏软导航栏
如果所有这些都不起作用,您可以尝试以下模块:
Appcelerator 模块 - 市场(免费):沉浸式视图
在另一个问题中也发现:How to hide the soft navigation bar on Android with Titanium?