Sunday, July 1, 2012

Re: [android-developers] ActionBar and forcing items into the overflow menu

The overflow only "appears" on devices and emulators that lack an off-screen MENU button. For devices and emulators that have an off-screen MENU button, pressing MENU displays the overflow menu. android:showAsAction="never" works just fine.

On Sun, Jul 1, 2012 at 4:56 AM, Anuj Goyal <anuj.goyal@gmail.com> wrote:
I am trying to force "reset" to show up in ActionBar's overflow (3 vertical dots). The appearance of summary is correct, but I can't seem to make the overflow appear.  What set of enums do I need for android:showAsAction?  I have tried these 3 variants but none give the desired result:

android:showAsAction="ifRoom|withText"
android:showAsAction="never|withText"
android:showAsAction="always|withText"

Maybe it's user error, but this would be useful to add to the docs

I have also looked on stackoverflow and have not found anything directly answering this question.

Inline image 3

<menu xmlns:android="http://schemas.android.com/apk/res/android" >
    <item
        android:id="@+id/menu_reset"
        android:icon="@drawable/ic_menu_reset"
        android:showAsAction="ifRoom|withText"
        android:title="@string/menu_reset"/>
    <item
        android:id="@+id/menu_summary"
        android:icon="@drawable/ic_menu_summary"
        android:showAsAction="always"
        android:title="@string/menu_summary"/>
</menu>

public class MainActivity extends Activity {

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activitymain);

ActionBar actionBar = getActionBar();
actionBar.show();
return;
}

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en



--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in NYC: http://marakana.com/training/android/

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate