Just write this method and call after initlize you tablayout.

					public static void TabWidth(TabLayout tabLayout, int margin, int indicatorHeight) {
        //int betweenSpace = margin;
        ViewGroup slidingTabStrip = (ViewGroup) tabLayout.getChildAt(0);

        for (int i = 0; i < slidingTabStrip.getChildCount(); i++) {
            View v = slidingTabStrip.getChildAt(i);
            ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) v.getLayoutParams();
            params.leftMargin = margin;
            params.rightMargin = margin;

Leave a Reply

Your email address will not be published. Required fields are marked *