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 8960951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:46:31+00:00 2026-06-15T15:46:31+00:00

I’ve seen a few posts about getting the title to show in actionbarsherlock along

  • 0

I’ve seen a few posts about getting the title to show in actionbarsherlock along with the icon. The icon is displaying fine, but the title does not show beside it.

Currently it shows the home icon with all the tabs beside it. What I am looking for is the home icon, then title, and below all this have the tabs show. Here is my code.

ACTIVITY

public class MainActivity extends SherlockFragmentActivity {

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

        mJsonHandler = JsonHandler.getInstance(this);
    }

 @Override
    public boolean onCreateOptionsMenu(Menu menu)
    {
        com.actionbarsherlock.view.MenuInflater inflater = getSupportMenuInflater();

        ActionBar ab = getSupportActionBar();

        ab.setDisplayHomeAsUpEnabled(true);
        ab.setDisplayShowTitleEnabled(true);
        ab.setDisplayShowHomeEnabled(true);
        ab.setDisplayUseLogoEnabled(true);

        ab.setTitle("TITLE TO SHOW");

        inflater.inflate(R.menu.activity_main, menu);

        return super.onCreateOptionsMenu(menu);     
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item)
    {
        switch(item.getItemId()) {
        case R.id.menu_item0:

            break;
        case R.id.menu_item1:

            break;
        case R.id.menu_item2:

            break;
        case R.id.menu_item3:

            break;
        case R.id.menu_item4:

            break;
        case R.id.menu_item5:

            break;
        default:
            this.onBackPressed();
            break;
        }
        return false;
    }
}

activity_main.xml (for menu)

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

<item
    android:id="@+id/menu_item0"
    android:orderInCategory="1"
    android:showAsAction="always"
    android:title="@string/menu_item0"/>

<item
    android:id="@+id/menu_item1"
    android:orderInCategory="2"
    android:showAsAction="always"
    android:title="@string/menu_item1"/>

<item
    android:id="@+id/menu_item2"
    android:orderInCategory="3"
    android:showAsAction="always"
    android:title="@string/menu_item2"/>

<item
    android:id="@+id/menu_item3"
    android:orderInCategory="4"
    android:showAsAction="always"
    android:title="@string/menu_item3"/>

<item
    android:id="@+id/menu_item4"
    android:orderInCategory="5"
    android:showAsAction="always"
    android:title="@string/menu_item4"/>

 <item
    android:id="@+id/menu_item5"
    android:orderInCategory="6"
    android:showAsAction="always"
    android:title="@string/menu_item5"/>

Manifest

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="15" />

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/Sherlock.Theme" >
    <activity
        android:name=".activities.MainActivity"
        android:label="@string/title_activity_main" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
  </application>

</manifest>

Sherlock Theme

<style name="Sherlock.Theme" parent="Theme.Sherlock.Light.DarkActionBar"> 
</style>
  • 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-15T15:46:32+00:00Added an answer on June 15, 2026 at 3:46 pm

    You’re setting too many menu items to always show in the ActionBar. You should only set the most important ones to do so. You should read through the Android Design Guidelines on the appropriate way to set up the ActionBar

    Android Design Guidelines – Action Bar organization

    Also, you should set up the ActionBar in onCreate and leave onCreateOptionsMenu for only inflating your menu(s). This is just a general tip and goes towards better, more professional code formatting.

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

Sidebar

Related Questions

Let's say I'm outputting a post title and in our database, it's Hello Y&#8217;all
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I am reading a book about Javascript and jQuery and using one of the
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I want to show the soap response to UIWebview.. my soap response is, <p><img
This could be a duplicate question, but I have no idea what search terms

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.