Google has just implemented a new look to their tabs in Google Play.
I know this can be done with ViewPagerIndicator, yet I wouldn\'t like to use another library in
The Design Support Library includes the TabLayout
widget which allows you to implement a Google Play-lie tabs:
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
and then initializing it:
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setupWithViewPager(viewPager);
For a full example see the Cheesesquare app
This is a ready-to-use library that you can find on Github.
Google finally released their sliding tabs api.
To use SlidingTabsBasic, you first need to download the zip file from: http://developer.android.com/downloads/samples/SlidingTabsBasic.zip
Example layout from Google:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.example.android.common.view.SlidingTabLayout
android:id="@+id/sliding_tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="1"
android:background="@android:color/white"/>
</LinearLayout>
Example code in the onCreate() method of your Activity:
mSlidingTabLayout = (SlidingTabLayout) view.findViewById(R.id.sliding_tabs);
mSlidingTabLayout.setViewPager(mViewPager);
For more details, follow the example in the zip file SlidingTabsBasicFragment.java and fragment_sample.xml
try this library
Sample project
It uses ViewPager
with fragment to display tabs as on google play.