【发布时间】:2017-03-16 19:54:36
【问题描述】:
如何在 Alloy/Titanium 上隐藏 Android 上的操作栏。我尝试了以下方法:
$.index.activity.actionBar.hide()
但它只是抛出错误:
Cannot read property 'hide' of undefined
完整的错误信息如下:
[ERROR] : TiExceptionHandler: (main) [1605,1605] ----- Titanium Javascript Runtime Error -----
[ERROR] : TiExceptionHandler: (main) [0,1605] - In /alloy/controllers/index.js:359,27
[ERROR] : TiExceptionHandler: (main) [1,1606] - Message: Uncaught TypeError: Cannot read property 'hide' of undefined
[ERROR] : TiExceptionHandler: (main) [0,1606] - Source: win.activity.actionBar.hide();
[ERROR] : V8Exception: Exception occurred at /alloy/controllers/index.js:359: Uncaught TypeError: Cannot read property 'hide' of undefined
【问题讨论】:
-
解决方案展示了隐藏操作栏的正确方法(使用主题或何时调用
hide()方法) -
@miga 我似乎找不到关于何时调用隐藏函数的解决方案。它们仅通过为窗口提供主题来提供替代方法。
-
见
Via win.activity.actionBar.hide(); you can only hide the Action Bar when your window is finally opened. The main disadvantage is that sometimes you can see the Action Bar for a few milliseconds, because the window is initially created with Action Bar所以你在open事件中使用它。不过,在你的 tss 中使用NoTitleBar主题更容易。
标签: android titanium appcelerator appcelerator-titanium titanium-alloy