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

  • Home
  • SEARCH
  • 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 7946763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:14:45+00:00 2026-06-04T01:14:45+00:00

I implemented ActionBarCompat to have an ActionBar across different OS versions. It is hidden

  • 0

I implemented ActionBarCompat to have an ActionBar across different OS versions.
It is hidden on smartphones, and displayed only on tablets.

I see that in this screenshot: http://developer.android.com/resources/samples/ActionBarCompat/index.html, the Share option menu displays the Logout option in a submenu, but when I compiled and run the sample code on a tablet, the Logout option was completely hidden and there wasn’t any option to display it as a submenu

Then I tried to do something like this:

<item        
    android:icon="@android:drawable/ic_menu_delete"
    android:orderInCategory="1"
    android:showAsAction="always"
    android:title="@string/menu_logout">
    <menu>
        <item
            android:id="@+id/menu_logout"                                
            android:title="@string/menu_logout"/>
    </menu>
</item>

And it really looks how I want – on a tablet, on a smartphone however, it has an undesired effect – when clicking the Logout option menu, it displays another context menu, which is because of nested menus I believe.

Do you know guys, how can I display a submenu when using the Action Bar on a tablet, and display just a regular option menu on smartphone? Maybe ActionBarCompat requires some additional configuration?

  • 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-04T01:14:46+00:00Added an answer on June 4, 2026 at 1:14 am

    I found a solution.
    The solution consists of having 2 separate menu resources files, for tablets and for smartphones: menu_tablet.xml, menu_smartphone.

    For tablets, I display a submenu:

    <item        
        android:icon="@android:drawable/ic_menu_delete"
        android:orderInCategory="1"
        android:showAsAction="always"
        android:title="@string/menu_logout">
        <menu>
            <item
                android:id="@+id/menu_logout"                                
                android:title="@string/menu_logout"/>
        </menu>
    </item>
    

    For smartphones I display as a regular option menu:

    <item        
            android:icon="@android:drawable/ic_menu_delete"
            android:orderInCategory="1"
            android:showAsAction="always"
            android:id="@+id/menu_logout"                                
            android:title="@string/menu_logout"    />
    

    And then in the code I inflate the appropriate menu resource like this:

    if(isTablet()){
        menuInflater.inflate(R.menu.menu_tablet, menu);
    }else{
        menuInflater.inflate(R.menu.menu_smartphone, menu);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I implemented class that serves as TcpCLient server. Looks like this: { [Export] public
I implemented the plist in my iOS game following this tutorial: Now I have
Implemented a generic repository with several Methods. One of those is this: public IEnumerable<T>
I implemented the Facebook registration on my website. Everything works fine except that suddenly
I implemented a feature that lets users set default profile photos and photo-album cover
I implemented a tree with an outputResource as content (see Downloading file from IceFaces
I implemented a UIAlertView that displays a tableView to make a selection and return
I implemented my Cub3r like this <script type=text/javascript> var flashvars = {}; flashvars.xml =
I implemented a slider in my jsp page and the code is as this,
I implemented posting on Twitter using this code Intent sharingIntent = new Intent(Intent.ACTION_SEND); sharingIntent.setClassName(com.twitter.android,

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.