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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:17:46+00:00 2026-05-29T05:17:46+00:00

divider in tabWidget is working fine but when background of tab widget is set

  • 0

divider in tabWidget is working fine but when background of tab widget is set like

tabHost.getTabWidget().getChildTabViewAt(tabId).setBackgroundResource(R.drawable.tab_indicator);

problem is how to set divider in tab widget after setting background
though i used

tabhost.getTabWidget().setDividerDrawable(R.drawable.tab_widget_divider);

is does not work for multiple tab.

  • 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-05-29T05:17:47+00:00Added an answer on May 29, 2026 at 5:17 am

    There may be multiple reasons for the dividers not showing up…

    1. setDividerDrawable() must be used before you add the tabs to the tabHost to work.

    2. By default there’s are -2(left), -2(right) margins set to each tabindicator’s View…

    By default the system is using 9-patch drawables for tabWidget backgrounds with at least 2 pixels left transparent(or semi-transparent for shadow-effect) to the left and the right side.

    my custom tab example

    1. demonstration


    original system 9-path drawable in android 2.3.3 (selected)enter image description here

    2. Stock 9-path drawables for tab widget background. You can use these for experimenting


    If you don’t wan’t to use 9-path drawables…
    you can set the margins to 0 to prevent the tab views overlapping your divider. Here’s the code:

        View v;
        int count = tw.getTabCount();
        for (int i = 0; i < count; i++) {
            v = tw.getChildTabViewAt(i);
            v.setBackgroundResource(R.drawable.bg_tab);
            ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) v.getLayoutParams();
            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'm trying to set the divider location of a JSplitPane but it seems not
I am trying to the set the background color for the JSplitPane divider. I've
I have created a divider in JSplitPane . I am unable to set the
The HTML looks something like this: <li class=divider> <div> ...(maybe more divs)... <div class=content>
I have added a divider as images to list view. but it is not
In ListView I can change the divider image using android:divider=image but I want to
I would like to display a sort of ListView with divider lines between each
How can I set the width of my custom ListView divider, in order to
I am not sure what they are called, but I would like a resizable
I need to create a specific shape for the Tab. It should look like

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.