问题描述
我想实现optionsMenu在WL应用,在Android中测试它(在我的项目设置SDK 10级,运行的是Android 4.0.3)。但是,没有菜单。我连接到我的本地服务器的HTC USB直通,所以我必须处理工作灯设置更改网络地址。
I'm trying to implement optionsMenu in a WL application, testing it in Android (sdk level 10 in my project settings, runtime is Android 4.0.3). But no menu is available. I'm connecting to my local server through HTC usb pass-through, so i have to deal with worklight settings to change network address.
我已经通过IBM的文档了(WL入门和信息中心),但没有完整的解释/ code。
I've gone through IBM doc (WL getting started and infocenter), but there is no full explanation/code.
下面是我的问题/问题:
Here are my questions/issues:
1)如何处理在应用程序descriptor.xml工作灯设置(我需要访问它作为本地测试目的的额外optionsMenu项):
1) how to deal with worklight settings in application-descriptor.xml (i need to access it as an additional optionsMenu item for local testing purpose):
<android version="1.0">
<worklightSettings include="true"/>
2)我应该在哪里初始化的optionsMenu? (我称之为的的document.ready jQuery函数的函数在我的html页面)
2) Where should i init the optionsMenu? (i call a function in the document.ready jquery function in my html page)
3)我已经把图标(xxxx.png)购买Android /本地/ RES /绘,这样可以吗?
3) i've put icons (xxxx.png) in Android/native/res/drawable, is it enough?
4)与Android SDK中10级有具体的问题?
4) are there specific issues with android sdk level 10 ?
推荐答案
由于 API等级10 ,谷歌已经开始引入新的UI控件。其中之一是在Action Bar,这是选项菜单的继任者。工作灯不具有操作栏全面支持。
Since API Level 10, Google has started to introduce new UI controls. One of them is the Action Bar, which is the successor of the Options Menu. Worklight does not have full support for the Action Bar.
作为一种变通方法,在的AndroidManifest.xml
修改 minSdkValue
到 8
,这将带回的常规 OptionsMenu
。这是我们在将来的版本,以更好地处理这种情况的心愿。
As a workaround, in AndroidManifest.xml
change the minSdkValue
to 8
, and this will bring back the 'regular' OptionsMenu
. It is in our wishlist for a future release to better handle this situation.
- 您已经正确地宣布它。
- 您可以在
wlCommonInit()
(位于yourProject \\ APPS \\ yourApp \\ COMMON \\ JS \\ appName.js $ C初始化$ C>)
- 是。要确保他们在每个DPI(文件夹)正确的分辨率。不过,我把它们放在
nativeResources \\水库\\&LT; dpiFolder&GT;
,因为如果你碰巧删除本地文件夹,这些图片都消失了为好。通过将它们放在nativeResources
,一旦它被建立后,他们创建将被复制到本地文件夹中。 - 是的,见上面。
- You've declared it correctly.
- You can initialize it in
wlCommonInit()
(located atyourProject\apps\yourApp\common\js\appName.js
) - Yes. Be sure they are in the correct resolution per DPI(folder). However, I would put them in
nativeResources\res\<dpiFolder>
, because if you happen to delete your native folder, these images are gone as well. By putting them innativeResources
, they will be copied to the native folder once it is created upon build. - Yes, see above.
这篇关于工作灯optionsMenu的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!