Single command shows as menu on Android 4.4 tablet?

81 views
Skip to first unread message

Timo van de Put

unread,
Feb 27, 2014, 6:51:35 AM2/27/14
to codenameone...@googlegroups.com
My app has one menu command, which is displayed as a "button" in the top right corner in all of the simulator skins.
But when I run this app on my Nexus 10 Android 4.4, a menu with a single menu item is shown.

How can I force it to become a "button" instead of a menu?

(I have set "commandBehavior" to 4 in the resource constants of the Designer, but this has no effect.)

Shai Almog

unread,
Feb 27, 2014, 2:42:55 PM2/27/14
to codenameone...@googlegroups.com
You need to set command behavior to Bar not to 4.

Timo van de Put

unread,
Feb 28, 2014, 2:43:32 AM2/28/14
to codenameone...@googlegroups.com
Hi Shai,


On Thursday, February 27, 2014 8:42:55 PM UTC+1, Shai Almog wrote:
You need to set command behavior to Bar not to 4.

Auch! - You are right. Now modified the command behavior to "Bar", and found out this does not solve my original problem:

I have a Form with a single command. This command shows up on iOS and in the Android simulator as a button at the right of the title bar, without a menu.
When I run this app on my Android 4.2 or 4.4 devices, the title bar includes a menu instead of the button. This menu holds just one item: the command.

How can I get the command behavior I see on the simulator (and on iOS) also on Android devices?

Shai Almog

unread,
Feb 28, 2014, 3:19:01 AM2/28/14
to codenameone...@googlegroups.com
Hi,
Title or Right might be better options for what you are trying to achieve.

Timo van de Put

unread,
Feb 28, 2014, 3:56:01 AM2/28/14
to codenameone...@googlegroups.com
Hi Shai,

Thank you for the quick answer! :-)


On Friday, February 28, 2014 9:19:01 AM UTC+1, Shai Almog wrote:
Hi,
Title or Right might be better options for what you are trying to achieve.

I have tried "Title", but the controls become too small on my Nexus 10 to be of any use. On my Android 2.2 device the command is no longer available from the menu button, which breaks the Android paradigm.

"Right" is not in the Designer documentation, and does not work. (It does not display any commands anymore.)

I really like what the simulator does in "Native" mode, but for some reason this is not the exact same behavior on an actual Android device. If a Form has only one Command, then it should on high-end Android devices show as a button instead of the menu.

Please migrate this behavior from the simulator to the actual devices.

Shai Almog

unread,
Feb 28, 2014, 12:52:02 PM2/28/14
to codenameone...@googlegroups.com
Hi,
I think that's ICS mode but I'm not sure.

Timo van de Put

unread,
Jul 13, 2014, 1:53:19 PM7/13/14
to codenameone...@googlegroups.com
Hi Shai,

My form menu has only a single command, and shows it as a button in the title bar on both the Simulator and a real Android 2.2 device.
On an Android 4.4 device however, it shows as a menu with a single item.

What is the rationale behind this behavior? (Or is it perhaps a bug?)

Thanks.

Shai Almog

unread,
Jul 14, 2014, 1:45:53 AM7/14/14
to codenameone...@googlegroups.com
Hi,
that is the default for Android 4. If you want the command to appear in the title bar you can use the command hints such as:
cmd.putClientProperty("android:showAsAction", "withText");
Or as the key "always", "withIcon" etc.

Timo van de Put

unread,
Jul 15, 2014, 3:01:41 AM7/15/14
to codenameone...@googlegroups.com
Thank you for the hint, which makes me curious about two things:

1. Where can I find a full list of the available Client Property keys and values?
2. How to I set a client property in the Codename One Designer?

Thanks


--
You received this message because you are subscribed to a topic in the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/codenameone-discussions/QpCd0iGlcwc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to codenameone-discu...@googlegroups.com.
Visit this group at http://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/874fd534-1205-4ffa-be0b-6e721790f80b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Shai Almog

unread,
Jul 15, 2014, 10:17:00 AM7/15/14
to codenameone...@googlegroups.com, ti...@familievandeput.nl
1. There is none. There are some for the side menu and if you search this list forum for showAsAction you should find the others relevant for Android.
2. You can't you need to do this from code.
Reply all
Reply to author
Forward
0 new messages