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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:22:35+00:00 2026-06-09T16:22:35+00:00

I am trying to create a custom tabview in the action bar, something like

  • 0

I am trying to create a custom tabview in the action bar, something like this:
enter image description here

I got this view:

enter image description here

i want to change the background of tabviews indicators, so backgroung color become invisible and we have the green line under the selected tabview indicator.

Here are my code (i used default tabview):

public class BaseActivity extends Activity{

    ActionBar bar;

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

        bar = getActionBar(); 

        // Change action bar background

        BitmapDrawable background = new BitmapDrawable(BitmapFactory.decodeResource(getResources(), R.drawable.background_actionbar)); background.setTileModeX(android.graphics.Shader.TileMode.REPEAT); 

        bar.setBackgroundDrawable(background);

        bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); 

        ActionBar.Tab tabA = bar.newTab().setText(getResources().getString(R.string.documents)); 

        ActionBar.Tab tabB = bar.newTab().setText(getResources().getString(R.string.videos)); 

        ActionBar.Tab tabC = bar.newTab().setText(getResources().getString(R.string.menu_settings)); 

        Fragment fragmentA = new DocumentsListFragment();

        Fragment fragmentB = new VideosListFragment();

        Fragment fragmentC = new UserAccountFragment();

        tabA.setTabListener(new MyTabsListener(fragmentA)); 

        tabB.setTabListener(new MyTabsListener(fragmentB)); 

        tabC.setTabListener(new MyTabsListener(fragmentC)); 

        bar.addTab(tabA);

        bar.addTab(tabB);

        bar.addTab(tabC);
    }


    protected class MyTabsListener implements ActionBar.TabListener
    {
        private Fragment fragment;

        public MyTabsListener(Fragment fragment) {
            this.fragment = fragment; }

        @Override

        public void onTabSelected(Tab tab, FragmentTransaction ft)
        {
            ft.replace(R.id.fragment_place, fragment, null); }

        @Override

        public void onTabReselected(Tab tab, FragmentTransaction ft) {
            // TODO Auto-generated method stub

        }

        @Override

        public void onTabUnselected(Tab tab, FragmentTransaction ft) {
            // TODO Auto-generated method stub

        }
    }

}

Please, how can i inflate those tabview indicator.

  • 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-09T16:22:36+00:00Added an answer on June 9, 2026 at 4:22 pm

    Add these are in styles.xml under values

     <style name="Theme.AndroidDevelopers" parent="Theme.Sherlock.Light.ForceOverflow"> 
     <item name=" android:actionBarItemBackground">@drawable/ad_selectable_background
     </item>
        <item name="android:actionBarTabStyle">@style/MyActionBarTabStyle</item>
        <item name="actionBarTabStyle">@style/MyActionBarTabStyle</item>
     </style>
    
    
    
    
    <style name="MyActionBarTabStyle" parent="Widget.Sherlock.Light.ActionBar.TabBar">
        <item name="android:background">@drawable/actionbar_tab_bg</item>
       <item name="android:gravity">center</item>
       <item name="android:layout_gravity">center</item>
        <item name="android:paddingLeft">10dp</item>
        <item name="android:paddingRight">10dp</item>
    </style>
    

    This is something like your Tab selector:

     <selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/ad_tab_selected_pressed_holo"           android:state_selected="true"/>
    <item android:drawable="@android:color/transparent"/>
    

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

Sidebar

Related Questions

I'm trying to create a custom helper like this: # app/controllers/my_controller.rb class MyController <
I'm trying to create Custom UIPickerView, something like below.. : http://img824.imageshack.us/img824/3015/pickercustom.png Example : From
I am trying to create a custom User library in CodeIgniter. Inside this library
I am trying to create a custom popup view that can be called from
I'm trying to create a custom usercontrol that acts like a button, but i
I am trying to create custom bullet points and it is not working. This
I am trying to create custom background selector for my ExpandableListView. It works fine
I am trying to create a custom user control in WPF. I want to
I am trying to create a custom shaped dialog in android. What I want
I am trying to create my custom view through xml, but the screen does

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.