I want to change the padding on the textview in the TabLayout. I have a tab that's called Subcategories. This is breaking line wrapping into two lines. Is there a way to do this?
There are answers only concerning the old TabHost view, I am using the TabLayout used by Google's Material Design library using android.support.design.widget.TabLayout.
For TabHost: How to add padding to a tabs label?
The TextView is not padded out, but the layout surrounding the textview is, so change the LinearLayout's padding:
int tabIndex = 0;
LinearLayout layout = ((LinearLayout)((LinearLayout)mTabLayout.getChildAt(0)).getChildAt(tabIndex));
layout.setPadding(0, 0, 0, 0);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With