Q:

How to add space between tab buttons in Android?

I need to separate tab buttons with space, I tried to set margin to views and then add them as tabs, but it does not work, I also thought of adding empty view as divider, but haven't tried it yet, is there any standard way of doing this, or any tweak that can achieve same effect?
Thanks!

A:

Here's the way:
TabWidget tabWidget = (TabWidget) findViewById(android.R.id.tabs);
final int tabChildrenCount = tabWidget.getChildCount();
View currentView;
for (int i = 0; i < tabChildrenCount; i++) {
    currentView = tabWidget.getChildAt(i);
    LinearLayout.LayoutParams currentLayout =
        (LinearLayout.LayoutParams) currentView.getLayoutParams();
    currentLayout.setMargins(0, 5, 5, 0);
}
tabWidget.requestLayout();

