Poor menu layout

by Edward Falk » Thu, 05 Mar 2009 05:25:10 GMT


Sponsored Links
 Hi all; I took a bare-bones "hello world" application and added these
four menu items in onCreateOptionsMenu():

+--------------------------------------------+
|                    Start                   |
+--------------------------------------------+
|                    Find                    |
+----------------------+---------------------+
|Enable Location Provid|        About        |
+----------------------+---------------------+

[you'll need a fixed-width font to view this properly]

As you can see, the menu was very poorly laid out.  Making my 3rd
label shorter fixed the problem, but this definitely looks like broken
behavior to me.  Is there anything I'm doing wrong here?  The relevant
code is:

  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    menu.add(Menu.NONE, Menu.NONE, Menu.NONE,
R.string.menu_start_label);
    menu.add(Menu.NONE, Menu.NONE, Menu.NONE,
R.string.menu_find_label);
    menu.add(Menu.NONE, Menu.NONE, Menu.NONE,
R.string.enable_location);
    menu.add(Menu.NONE, Menu.NONE, Menu.NONE,
R.string.menu_about_label);
    return true;
  }


full source available at  http://www.efalk.org/tester3.tar.gz 

ADVthanksANCE,

  -ed falk
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Why are all audio formats always passed to the Music Player ?

What do you use to start the files?  A file manager app?




-- 

2. In GridView the focus item position moved to left when we press space key to page down.

In Android when we open app using Gridview Ex. Gallery.
In device with keyboard, when we press Shift key, the focused item
will change its position to left.
Is it Android's SPEC or bug??

I checked the Gridview.java source code.
In PageScroll() function, when we press space key, it does page down.
And focused item is Math.min(mItemCount - 1, mSelectedPosition +
getChildCount() - 1);
It will plus getChildCount() which means number of one page items.
However, why does it minus 1?? it leads focus item move to left
position.

 if (direction == FOCUS_UP) {
            nextPage = Math.max(0, mSelectedPosition - getChildCount()
- 1);
        } else if (direction == FOCUS_DOWN) {
            nextPage = Math.min(mItemCount - 1, mSelectedPosition +
getChildCount() - 1);
        }
        if (nextPage >= 0) {
            setSelectionInt(nextPage);
            invokeOnItemScrollListener();
            awakenScrollBars();
            return true;
        }

-- 

3. Froyo for Galaxy S.. tomorrow

4. Background in PreferenceScreen

5. Broadcast business card

6. How to install apk in device using window machine

7. Blutooth API Problem