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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:25:20+00:00 2026-06-12T20:25:20+00:00

I would like to have an ActionBar with custom navigation where the custom views

  • 0

I would like to have an ActionBar with custom navigation where the custom views look like the standard action bar tabs. I know it sounds like reinventing the wheel but it means we can have the menu button on the same row as the tabs as shown below. This is a design requirement and practically makes much more UI sense for this app than the standard android behaviour.
How I would like the tabs to look

I’ve tried using an IcsLinearLayout from ActionBarSherlock like so:

<IcsLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="fill_parent"
          android:orientation="horizontal"
          android:layout_height="50dip">
         <Button
             android:id="@+id/tab_1"
             android:layout_height="match_parent"
             android:gravity="center"
             android:layout_width="wrap_content"
             android:textStyle="bold"
             android:text="TAB_1"
             android:background="@drawable/abs__item_background_holo_light"
             />
        <Button
            android:id="@+id/tab_2"
            android:layout_height="match_parent"
            android:gravity="center"
            android:layout_width="wrap_content"
            android:textStyle="bold"
            android:text="TAB_2"
            android:background="@drawable/abs__item_background_holo_light"
             />
</IcsLinearLayout>

But that replicates ActionButtons and I have no idea how to replicate Tabs.

I assume I will need:

  • a special tab container viewgroup (probably from the
    ActionBarSherlock library)
  • views which look like tabs with a
    background resource from the ABS library.
  • some code to indicate that
    after the view is clicked it remains selected (similar to a
    RadioButton).

Any pointers to samples or similar solutions (even within the ActionBarSherlock library) would be greatly appreciated.

  • 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-12T20:25:21+00:00Added an answer on June 12, 2026 at 8:25 pm

    //enabling embedded tabs

    //pre-ICS
    if (actionBarSherlock instanceof ActionBarImpl) {
        enableEmbeddedTabs(actionBarSherlock);
    
    //ICS and forward
    } else if (actionBarSherlock instanceof ActionBarWrapper) {
        try {
            Field actionBarField = actionBarSherlock.getClass().getDeclaredField("mActionBar");
            actionBarField.setAccessible(true);
            enableEmbeddedTabs(actionBarField.get(actionBarSherlock));
        } catch (Exception e) {
            Log.e(TAG, "Error enabling embedded tabs", e);
        }
    }
    
    //helper method
    private void enableEmbeddedTabs(Object actionBar) {
        try {
            Method setHasEmbeddedTabsMethod = actionBar.getClass().getDeclaredMethod("setHasEmbeddedTabs", boolean.class);
            setHasEmbeddedTabsMethod.setAccessible(true);
            setHasEmbeddedTabsMethod.invoke(actionBar, true);
        } catch (Exception e) {
            Log.e(TAG, "Error marking actionbar embedded", e);
        }
    }
    

    this code works perfectly . Tried it in my app .
    for further reference – https://groups.google.com/forum/#!topic/actionbarsherlock/hmmB1JqDeCk

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

Sidebar

Related Questions

I would like to have a vertical navigation bar with these images. I seem
I have an app with an action bar that looks like this: I would
I have an actionBar with multiple items, I would like to change the colour
I would like to have a custom view in my application that consists of
I would like to have a dark ActionBar but have the rest of the
I have a tabhost with three tabs. Each is an activity. I would like
I would like to place the navigation bar at the top of each activity
I would like to create an always-expanded search window in my action bar. I
So in my project i would like have a nice treeview that has images.
I would like to have an AppWidget that designed like this one . Image:

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.