这种方法一直对我有用,将应用设置为全屏,没有导航栏和标签栏。
假设您的主窗口的 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 博客上查看这篇文章: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?