Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove spacing to tab widget in Android? [duplicate]

enter image description here

I want this spacing between the tabs removed, How can this be achieved ?

like image 351
R KiranKumar Avatar asked Feb 21 '13 05:02

R KiranKumar


2 Answers

I solved this issued by,

tabHost.getTabWidget().setDividerDrawable(null);

If your build target is Honeycomb onwards, you may use the following code also.

if (Integer.parseInt(Build.VERSION.SDK) >= Build.VERSION_CODES.HONEYCOMB) {
    tabHost.getTabWidget().setShowDividers(LinearLayout.SHOW_DIVIDER_NONE);
}
like image 180
No_Rulz Avatar answered Sep 21 '22 13:09

No_Rulz


Before some times i have the same problem and my problem was resolved by setting padding to "0". I thinks, its taking some padding by default. So if you don't want space between your TabWidget, try the blow code.Please let me know if my solution will resolve your problem.

for (int i = 0; i < tabHost.getTabWidget().getChildCount(); i++) {
        tabHost.getTabWidget().getChildAt(i).setPadding(0, 0, 0, 0);
    }
like image 43
Akanksha Rathore Avatar answered Sep 20 '22 13:09

Akanksha Rathore