Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8050559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:06:51+00:00 2026-06-05T07:06:51+00:00

I have an ActionBar that should display the action buttons in a custom way.

  • 0

I have an ActionBar that should display the action buttons in a custom way. For this I created a custom view and attached it to the ActionBar.

One thing to mention is that I am using a menu.xml resoure file to load the options menu and display them on a smartphone, but do not display them on tablet, instead use a custom view. For this I market every menu item in the xml as: android:showAsAction="never"

Everything looks fine, except one little thing that still remains on the right of the ActionBar – the “More” button.

How can I remove it?

enter image description here

I tried this:

ActionBar bar = activity.getActionBar();
bar.removeAllTabs();

but the “more” button still remains there.

EDIT:
This is my menu.xml file:

<menu xmlns:android="http://schemas.android.com/apk/res/android" >

    <item
        android:id="@+id/menu_username"
        android:icon="@drawable/menu_username"
        android:orderInCategory="0"
        android:showAsAction="never"
        android:title="@string/menu_username">
        <menu>
            <item
                android:id="@+id/menu_logout"
                android:title="@string/menu_logout"/>
        </menu>
    </item>

    <item
        android:id="@+id/menu_settings"
        android:icon="@drawable/menu_settings"
        android:orderInCategory="1"
        android:showAsAction="never"
        android:title="@string/menu_settings"/>

    <item
        android:id="@+id/menu_search"
        android:icon="@drawable/menu_search"
        android:orderInCategory="1"
        android:showAsAction="never"
        android:title="@string/menu_search"/>

</menu>

Please note I still want to inflate this menu on a smartphone, but don’t want to use it on a tablet.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T07:06:53+00:00Added an answer on June 5, 2026 at 7:06 am

    Setting showAsAction="never" will force an menu item into the overflow. Why not check in onCreateOptionsMenu(…) that the device is a tablet, and if it is just not inflate the menu? Something like this:

    public boolean onCreateOptionsMenu(Menu menu) {
        if (getResources().getConfiguration().smallestScreenWidthDp >= 600) {
            //It's a tablet, don't inflate, only create the manual view
            manualMenuCreation();
        } else {
            getMenuInflater().inflate(R.menu.menu, menu);
        }
        return true;
    }
    

    Don’t forget smallestScreenWidthDp is only available in 3.2 or above, so you’ll have to take that into consideration.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a actionbar with a custom layout, but this show me the icon
While working on my application, I used a custom ActionBar view: this.getSupportActionBar().setCustomView(R.layout.actionbar_bg); this.getSupportActionBar().setDisplayShowCustomEnabled(true); Ubfortunately,
I have an FragmentActivity that uses the ActionBar Tabs, one of the tabs has
I have searched the numerous questions that look like this one, but haven't found
I have noticed that when using actionBar.setSelectedNavigationItem(x) in the onCreate() method of my Activity,
I have an app that uses the ActionBar with tabs in combination with Fragments.
I'm developing a simple Android application that would have an action bar on the
I have this application where I implement the ActionBar Fragment interface. Underlying the interface,
my app have action bar on top of windows. Where are some buttons. Buttons
I have an Android app that uses ActionBar Sherlock. I create a menu that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.