Hello, I have focused on the implementation of TabLayout, in which you will also get to know how ViewPager & FragmentPagerAdapter plays an important role to provide more functionality to the TabLayouts.
-
Extend FragmentPagerAdapter in a java class TabPagerAdapter.
-
Implementation of design support library in build.gradle(Module:app).
-
Remove ActionBar, check res->values->styles.xml.
-
Making Custom Style for TabLayout using Widget.Design.TabLayout, check res->values->Styles.xml.
-
Proper use of text & colors in strings.xml & colors.xml file in a project, check res->values.
In TabPagerAdapter java class extend FragmentPagerAdapter and implement method:
- getItem(int i)
@Override public Fragment getItem(int i) { if(i==0){ return new TabOne(); } else if(i==1){ return new TabTwo(); } else return new TabThree(); }- getCount()
@Override public int getCount() { //Total number of tabs return 3; }