Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
238 views
in Technique[技术] by (71.8m points)

android - SlidingTabLayout to fit the screen

I am using Google's SlidingTabLayout. As i only have 3 tabs to be displayed, I am seeing empty space after last tab. Please screenshot below. enter image description here

Can someone explain me how to fit the tabs to entire screen. Thanks for your time.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Use this before setViewPager():

slidingTabs.setDistributeEvenly(true);

If you got this error Cannot resolve method 'setDistributeEvenly(boolean)', you should update your SlidingTabLayout.java and SlidingTabStrip.java from Google I/O source code:

SlidingTabLayout.java

SlidingTabStrip.java


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...