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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:47:12+00:00 2026-06-15T04:47:12+00:00

I have tried everything and I can’t get this to work. I have read

  • 0

I have tried everything and I can’t get this to work. I have read all related posts on this topic, but havent found a working solution!

I wanna change the tab bar text size using ActionBarSherlock. I’ve managed to change the actionbar, but not the tabs text underneath (or the tabs themselves for that matter).

In styles.xml I have (one of many tries):

<style name="ANM_Theme" parent="Theme.Sherlock">
<item name="actionBarTabTextStyle">@style/Theme_ActionBarText</item>
<item name="android:actionBarTabTextStyle">@style/Theme_ActionBarText</item>

<style name="Theme_ActionBarText" parent="Widget.Sherlock.ActionBar.TabText">
<item name="android:textColor">#fff</item>
<item name="android:textSize">6sp</item>

And in my activity i set

public static int THEME = R.style.ANM_Theme;

And then

setTheme(THEME);

Before

super.onCreate(savedInstanceState);

EDIT:

Just realized that when you are using Tabs+Pager you don’t get the 4.0 look on the tabs! That clarifies why I can’t customize the tabs through the ActionBarSherlock theme.. I was trying on a 4.1 device. Downloaded the ActionBarSherlock demo app and got the same results..

Anyone know how to fix it?

  • 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-15T04:47:13+00:00Added an answer on June 15, 2026 at 4:47 am
    public class MainActivity extends SherlockFragmentActivity {
    ViewPager  mViewPager;
    TabsAdapter mTabsAdapter;
    
    Button testButton;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ActionBar bar = getSupportActionBar();
        bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    
        mViewPager = (ViewPager)findViewById(R.id.pager);
    
        // Add the tabs
        mTabsAdapter = new TabsAdapter(this, bar, mViewPager);
        mTabsAdapter.addTab(bar.newTab().setText("First"),
                FragmentA.class, null);
        mTabsAdapter.addTab(bar.newTab().setText("Second"),
                FragmentB.class, null);
        mTabsAdapter.addTab(bar.newTab().setText("Third"),
                FragmentC.class, null);
    
        setTitle(R.string.app_name);
    
        if (savedInstanceState != null) {
            bar.setSelectedNavigationItem(savedInstanceState.getInt("tab"));
        }
    }
    
    @Override
    protected void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        outState.putInt("tab", getSupportActionBar().getSelectedNavigationIndex());
    }
    
    @Override
    public boolean onCreateOptionsMenu(com.actionbarsherlock.view.Menu menu) {
    
        menu.add("Refresh")
            .setIcon(R.drawable.ic_action_refresh)
            .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    
        SubMenu subMenu1 = menu.addSubMenu("Menu");
        subMenu1.add("Sample");
        subMenu1.add("Items");
        subMenu1.add("In menu");
    
        MenuItem subMenu1Item = (MenuItem) subMenu1.getItem();
        subMenu1Item.setIcon(R.drawable.ic_action_overflow);
        subMenu1Item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
    
        return super.onCreateOptionsMenu(menu);
    }
    
    @Override
    public boolean onOptionsItemSelected(com.actionbarsherlock.view.MenuItem item) {
        String itemTitle  = (String) item.getTitle();
    
            if(!itemTitle.equals("Menu")){
                Toast toast = Toast.makeText(getApplicationContext(), itemTitle+" pressed", Toast.LENGTH_SHORT);
                toast.show();
            }
    
    
        if(item.getItemId() == android.R.id.home){
            getSupportFragmentManager().popBackStackImmediate();
        }
        return super.onOptionsItemSelected(item);
    
    }
    
    
    
    public static class TabsAdapter extends FragmentPagerAdapter
            implements ViewPager.OnPageChangeListener, ActionBar.TabListener {
        private final Context mContext;
        private final ActionBar mBar;
        private final ViewPager mViewPager;
        private FragmentActivity mActivity;
        private final ArrayList<TabInfo> mTabs = new ArrayList<TabInfo>();
    
        static final class TabInfo {
            private final Class<?> clss;
            private final Bundle args;
    
            TabInfo(Class<?> _class, Bundle _args) {
                clss = _class;
                args = _args;
            }
        }
    
        public TabsAdapter(FragmentActivity activity, ActionBar bar, ViewPager pager) {
            super(activity.getSupportFragmentManager());
            mContext = activity;
            mActivity = activity;
            mBar = bar;
            mViewPager = pager;
            mViewPager.setAdapter(this);
            mViewPager.setOnPageChangeListener(this);
    
        }
    
        public void addTab(ActionBar.Tab tab, Class<? extends Fragment> clss, Bundle args) {
            TabInfo info = new TabInfo(clss, args);
            tab.setTag(info);
            tab.setTabListener(this);
            mTabs.add(info);
            mBar.addTab(tab);
            notifyDataSetChanged();
        }
    
        @Override
        public int getCount() {
            return mTabs.size();
        }
    
        @Override
        public Fragment getItem(int position) {
            TabInfo info = mTabs.get(position);
            return Fragment.instantiate(mContext, info.clss.getName(), info.args);
        }
    
        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
        }
    
        @Override
        public void onPageSelected(int position) {
            mBar.setSelectedNavigationItem(position);
        }
    
        @Override
        public void onPageScrollStateChanged(int state) {
        }
    
        @Override
        public void onTabSelected(Tab tab, FragmentTransaction ft) {
            mActivity.getSupportFragmentManager().popBackStack();
            Object tag = tab.getTag();
            for (int i=0; i<mTabs.size(); i++) {
                if (mTabs.get(i) == tag) {
                    mViewPager.setCurrentItem(i);
                }
            }
        }
    
        @Override
        public void onTabUnselected(Tab tab, FragmentTransaction ft) {
    
        }
    
        @Override
        public void onTabReselected(Tab tab, FragmentTransaction ft) {
    
        }
    
    
    }
    

    }

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

Sidebar

Related Questions

I have tried everything I can think of to get this to work, to
Cant get this script to work with my menu really have tried everything any
I have tried everything I can think of to fix this, but I can't
I have tried everything I can think of to get this event to trigger
Having an issue here that I have tried everything I can think of but
This might get a little confusing as I have tried everything to make this
I have tried everything I can think of and every code sample imaginable but
I have tried everything I can think of in css in order to get
I believe I have a syntax error, but I have tried everything and can't
I have this code and I have tried everything i can think of to

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.