Worklight optionsMenu

青春壹個敷衍的年華 提交于 2020-01-04 03:57:07

问题


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.

I've gone through IBM doc (WL getting started and infocenter), but there is no full explanation/code.

Here are my questions/issues:

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) Where should i init the optionsMenu? (i call a function in the document.ready jquery function in my html page)

3) i've put icons (xxxx.png) in Android/native/res/drawable, is it enough?

4) are there specific issues with android sdk level 10 ?


回答1:


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.

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.

  1. You've declared it correctly.
  2. You can initialize it in wlCommonInit() (located at yourProject\apps\yourApp\common\js\appName.js)
  3. 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 in nativeResources, they will be copied to the native folder once it is created upon build.
  4. Yes, see above.


来源:https://stackoverflow.com/questions/15704539/worklight-optionsmenu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!