Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SlidingTabLayout setDistributeEvenly missing

I'm using the SlidingTabLayout.java from developers android page. Before I used slidingTabLayout.setDistributeEvenly(true); to center the slidingtab but now the method is missing. What's the alternative? I could use the old java class but I suppose there is an alternative method to do the same thing.

like image 450
Manuel Castro Avatar asked Jan 17 '26 06:01

Manuel Castro


1 Answers

In your SlidingTabLayout add the following:

LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(0, LayoutParams.WRAP_CONTENT, 1f);
tabView.setLayoutParams(lp);

just before

mTabStrip.addView(tabView);

After that you won't even need slidingTabLayout.setDistributeEvenly(true); the tabs will automatically center themselves.

like image 66
user1801060 Avatar answered Jan 19 '26 18:01

user1801060



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!