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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:00:58+00:00 2026-06-10T15:00:58+00:00

I have an app that uses ActionBarSherlock to provide a ViewPager control for tab

  • 0

I have an app that uses ActionBarSherlock to provide a ViewPager control for tab navigation, as well as a standard ActionBar. Everything’s working fine, except for the fact that when I use a custom ActionBar view, the action bar moves its position to below the tab controls.

When using a standard ActionBar (i.e. no custom view), everything works as expected:

enter image description here

However, when I switch the ActionBar to use a custom view (with no other code changes whatsoever), the action bar switches to below the tab controls:

enter image description here

Is there any particular reason for this? Is there anything I can do to use a custom action bar view, but still laid out with the action bar above the tabs? All of the XML layouts being used in this example are extremely bare-bones, as noted in the code below.

I’m using ActionBarSherlock 4.1.0 (as of this writing, the latest stable release). This behavior occurs on both Android 2.2 (the earliest version I’m supporting) and Android 4.1.

My ABS initialization code:

setContentView( R.layout.main ); // XML layout that currently contains only the ViewPager
mViewPager = (ViewPager) findViewById( R.id.viewPager );

// Set up action bar
ActionBar ab = getSupportActionBar();
Drawable gd = getResources().getDrawable( R.drawable.actionbar_bg ); // Background gradient
ab.setBackgroundDrawable( gd );
ab.setCustomView( R.layout.actionbar_custom ); // For this example, contains just a TextView
ab.setDisplayOptions( ActionBar.DISPLAY_SHOW_CUSTOM );

// Set up tabs
ab.setNavigationMode( ActionBar.NAVIGATION_MODE_TABS );
mTabsAdapter = new TabsAdapter( this, mViewPager );
mTabsAdapter.addTab( ab.newTab().setText( "Tab 1" ), Tab1Fragment.class, null );
mTabsAdapter.addTab( ab.newTab().setText( "Tab 2" ), Tab2Fragment.class, null );
mTabsAdapter.addTab( ab.newTab().setText( "Tab 3" ), Tab3Fragment.class, null );
  • 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-10T15:00:59+00:00Added an answer on June 10, 2026 at 3:00 pm

    Murphy’s Law of stumbling onto the answer for your own question right after you post it to Stack Overflow strikes again.

    Adding ActionBar.DISPLAY_SHOW_HOME to ab.setDisplayOptions() will cause the ActionBar to return to the top of the screen.

    That’s an acceptable solution for this particular project (as I probably will want to have the Home icon there regardless), but I would still be curious to know if there’s any other way to accomplish this for those who — for some reason — would not prefer to display the Home icon.

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

Sidebar

Related Questions

I have an app that uses the ActionBar with tabs in combination with Fragments.
I have an Android app that uses ActionBar Sherlock. I create a menu that
I have an app that uses the navigation controls. What I would like is
I have an app that uses a UINavigationController to control its flow, and I
Have an app that uses git for version control. A file called mkmf.log keeps
I am migrating my app that uses actionbarsherlock 3.5 to actionbarsherlock 4.2. Almost everything
I have an app that uses Apples reachability code. When I tab out of
I have an app that uses a tab bar controller. It has five tabs.
I have this App that uses the Webbrowser control to do automated browsing. I
I have an android app that uses ActionbarSherlock and I want to put an

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.