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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T07:57:48+00:00 2026-06-16T07:57:48+00:00

I am wondering is it possible to apply ActionBarSherlock (v4.2.0) TabWidget theme on native

  • 0

I am wondering is it possible to apply ActionBarSherlock (v4.2.0) TabWidget theme on native TabWidget? So it will looks like Holo on pre ICS androids. If you know how – please share.

All i found is this: https://gist.github.com/1126843 but it seems not work anymore.

Standard xml layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <TabHost
        android:id="@android:id/tabhost"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical" >

            <TabWidget
                android:id="@android:id/tabs"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" >
            </TabWidget>

            <FrameLayout
                android:id="@android:id/tabcontent"
                android:layout_width="match_parent"
                android:layout_height="match_parent" >
            </FrameLayout>
        </LinearLayout>
    </TabHost>
</LinearLayout>
  • 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-16T07:57:50+00:00Added an answer on June 16, 2026 at 7:57 am

    I found some solution myself. It’s not pure ABS resources but use minimum additional things:

    Almost same as ABS selector except

    <item android:state_focused="false" android:state_selected="false" android:state_pressed="false" android:drawable="@drawable/abs__ab_transparent_light_holo" />
    

    tab_indicator_compat_holo.xml

    <selector xmlns:android="http://schemas.android.com/apk/res/android">
    <!-- Non focused states -->
    <item android:state_focused="false" android:state_selected="false" android:state_pressed="false" android:drawable="@drawable/abs__ab_transparent_light_holo" />
    <item android:state_focused="false" android:state_selected="true"  android:state_pressed="false" android:drawable="@drawable/abs__tab_selected_holo" />
    
    <!-- Focused states -->
    <item android:state_focused="true" android:state_selected="false" android:state_pressed="false" android:drawable="@drawable/abs__list_focused_holo" />
    <item android:state_focused="true" android:state_selected="true"  android:state_pressed="false" android:drawable="@drawable/abs__tab_selected_focused_holo" />
    
    <!-- Pressed -->
    <!--    Non focused states -->
    <item android:state_focused="false" android:state_selected="false" android:state_pressed="true" android:drawable="@drawable/abs__list_pressed_holo_dark" />
    <item android:state_focused="false" android:state_selected="true"  android:state_pressed="true" android:drawable="@drawable/abs__tab_selected_pressed_holo" />
    
    <!--    Focused states -->
    <item android:state_focused="true" android:state_selected="false" android:state_pressed="true" android:drawable="@drawable/abs__tab_unselected_pressed_holo" />
    <item android:state_focused="true" android:state_selected="true"  android:state_pressed="true" android:drawable="@drawable/abs__tab_selected_pressed_holo" />
    

    Activity

    private void initTabs(){
        TabHost tabHost = (TabHost)getView().findViewById(android.R.id.tabhost);
        tabHost.setup();
    
        TabSpec podcasts_all = tabHost.newTabSpec("tab1");
        TabSpec podcasts_downloaded = tabHost.newTabSpec("tab2");
        TabSpec podcasts_favorite = tabHost.newTabSpec("tab3");
    
    
        if(Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB){
            //set divider drawable
    
            tabHost.getTabWidget().setDividerDrawable(com.actionbarsherlock.R.drawable.abs__list_divider_holo_light);
    
            //set tab titles with custom view
            podcasts_all.setIndicator(customTabTextView(getSherlockActivity().getString(R.string.PodcastManager_All_Title)));
            podcasts_downloaded.setIndicator(customTabTextView(getSherlockActivity().getString(
                    R.string.PodcastManager_Downloaded_Title)));
            podcasts_favorite.setIndicator(customTabTextView(getSherlockActivity().getString(
                    R.string.PodcastManager_Favorite_Title)));
        }else{
            //set tab titles
            podcasts_all.setIndicator(getSherlockActivity().getString(R.string.PodcastManager_All_Title));
            podcasts_downloaded.setIndicator(getSherlockActivity().getString(
                    R.string.PodcastManager_Downloaded_Title));
            podcasts_favorite.setIndicator(getSherlockActivity().getString(R.string.PodcastManager_Favorite_Title));
        }
    
    
        tabHost.addTab(podcasts_all);
        tabHost.addTab(podcasts_downloaded); 
        tabHost.addTab(podcasts_favorite); 
    
    
        //fill background with selector drawable
        if(Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB){
            setTabsBackground(tabHost);
        }
    
    }
    
    private View customTabTextView(String text){
        TextView txtTab = new TextView(getActivity());
        txtTab.setText(text.toUpperCase());
        txtTab.setPadding(0, 5, 0, 0);
        txtTab.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12);
        txtTab.setTextColor(Color.DKGRAY);
        txtTab.setGravity(Gravity.CENTER);
        txtTab.setTypeface(Typeface.MONOSPACE, Typeface.BOLD);
        txtTab.setHeight(34);
    
        return txtTab;
    }
    
    private void setTabsBackground(TabHost tabHost) {
        View v;
        int count = tabHost.getTabWidget().getTabCount();
        for (int i = 0; i < count; i++) {
            v = tabHost.getTabWidget().getChildTabViewAt(i);
            v.setBackgroundResource(R.drawable.tab_indicator_compat_holo);
    
            ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) v.getLayoutParams();
            //Fix margins in 2.x, by default there is -2  
            params.setMargins(0, 0, 0, 0);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was wondering if it was possible to apply effects to retrieved elements within
Possible Duplicate: Styling select options I am wondering if it is possible to apply
After this conversation I started wondering if it's possible to use that and apply
I am wondering if it is possible to make an overlay effect like the
I was wondering - is it possible to apply the jQuery UI CSS to
Just wondering if it's possible to add a button like the Clear History, Clear
I was just wondering if it is possible to apply an attribute to a
I'm just wondering that it is possible to apply two different filters in IE
Just wondering if it's possible to apply a *.css to a spark TextArea? If
I'm wondering if it is possible to apply an htaccess directive to a symlinked

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.