iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
Hello Crosslight Support,
today I was trying to create a simple option menu. Which means a menu which appears when I hit the hardware button on the bottom left side of my android phone.
With plain Xamarin Android I had about 5 minutes to manage it. With Crosslight I failed.
The attached file "Screenshot_2014..." shows the plain Xamarin app and the result I want to achieve.
The Crosslight project is attached as "CrosslightOptionMenu.zip" and is based on the blank project template. I just added some code to the SimpleActivity class and in the Resource folder I added a menu folder and a menu.xml file which contains the menu definition. When starting the app the "OnCreateOptionsMenu" method is hit but the new menu definiton is not recognized within the Resource class. See "optionmenu" attachment. I tried some workarounds like placing the menu under the Layout folder or entering the resource id of the menu directly but had no success with that.
Please, try to reproduce the problem. Originally I wanted to achieve this with a "TabActivity", so make sure that every activity is checked. This is very urgent, so it would be nice to get a hotfix based on Crosslight 2 Update 3. Further I need a sample how to navigate to another activity when hitting an option menu entry. Could you please add this to my sample provided as attachment.
Thanks,
Thomas
Please try to do the following:
protected override int MenuLayoutId { get { return Resource.Menu.menu; } }
public SimpleBindingProvider() { ... this.AddBinding("new_game", BindableProperties.CommandProperty, "NewGameCommand"); this.AddBinding("help", BindableProperties.CommandProperty, "HelpCommand"); }
I enclosed the modified project as reference. Please let us know whether this help or not.
Hello Yudi,
I had not much time to test it, but on the first view it is exactly what I wanted to do.
Thanks a lot.
PS: Where can I find these things in the documentation? If I had better tutorials or how-tos, I would have less support questions. Though your support is excellent and quick.
in the menu.xml I also defined menu icons. When a menu item is shown in the action bar then the assigned menu icon is shown there. When I hit the hardware button and the menu pops up from the bottom there is only the text of the menu items but not their icons.
Any chance to show the icons, too?
the original setup is still not working. I have a multi page application with different tabs. Each tab is a fragment. I added your code to the ViewModel, the BindingProvider and the Fragment of the first tab, but it is not working. I do not get an error, but when clicking on a menu item there is no connection to the ViewModel. The code of the different commands is not executed (no toast meassage appears).
Can you please check again with a multi page scenario.
I modified menu.xml file and use nested menu item approach to show action bar with icons.
The modified version is as follow.
<?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/test3" android:icon="@drawable/icon" android:title="Test3" android:showAsAction="withText|ifRoom"/> <item android:id="@+id/test4" android:icon="@drawable/icon" android:title="Test4" android:showAsAction="withText|ifRoom"/> <item android:id="@+id/dummy" android:icon="@drawable/icon" android:showAsAction="always|withText"> <menu> <item android:id="@+id/new_game" android:title="About" android:icon="@drawable/icon" android:showAsAction="withText|ifRoom"/> <item android:id="@+id/help" android:icon="@drawable/icon" android:title="Help" android:showAsAction="withText|ifRoom"/> <item android:id="@+id/test" android:icon="@drawable/icon" android:title="Test" android:showAsAction="withText|ifRoom"/> <item android:id="@+id/test1" android:icon="@drawable/icon" android:title="Test1" android:showAsAction="withText|ifRoom"/> </menu> </item> </menu>
Please let me know whether it helps or not.
Unfortunately, this does not help. I don't need nested menus. I need the menu to work in a multi page scenario. Please, read my description in the last post. Let me know if my description is unclear or confusing. If it is easier for you, I can send you a sample project, too.
I was able to reproduce the reported problem using Multi Page project template.
Crosslight development team found that the Option menu bindings are not correctly registered in TabActivity. The team is now working on this. It is submitted under CROS-527.
I will keep this thread updated with any news I heard from the team regarding CROS-527.
Edited on August 26, 2014 11:03 PMReason: Update status of CROS-527
I'd like to inform you that a nightly build hotfix is available which resolves the problem of Option menu bindings which are not correctly registered in TabActivity. The nightly build is available in here.
Please have the nightly build hotfix evaluated on your end and let me know whether it helps or not.
I did a short test with the TabActivity and the bug seems to be fixed.
When hitting the hardware button on the bottom left side of my device, the context menu pops up, but I only see the text and not the icons of the menu entries. Why?
I'm pretty sure that your application is tested on Android 3.0+. On Android 3.0+, the icons in the menu are not shown by design. This is a design decision by Google.
The icons will show up if you promote an options menu item to be a toolbar button, and the icons will show up on Android 1.x/2.x devices.
I found similar discussion in here that might be useful. For more detail, you can read more at Android Developers Blog.
Hope this help.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname