这种方法总是对我有用,将应用程序设置为全屏,没有导航栏和标签栏。
假设您的主窗口的 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
验证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 http://www.appcelerator.com/blog/2014/08/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 文档:使用沉浸式全屏模式 https://developer.android.com/training/system-ui/immersive.html
Appcelerator 文档:隐藏软导航栏 http://docs.appcelerator.com/platform/latest/#!/guide/Titanium_SDK_5.2.0_Release_Note-section-46245011_TitaniumSDK5.2.0ReleaseNote-AndroidPlatform
如果所有这些都不起作用,您可以尝试以下模块:
Appcelerator 模块 - 市场(免费):
沉浸式视图 https://marketplace.appcelerator.com/apps/27660#!overview
在另一个问题中也发现:如何使用 Titanium 隐藏 Android 上的软导航栏? https://stackoverflow.com/questions/35888880/how-to-hide-the-soft-navigation-bar-on-android-with-titanium