1:TabLayout 的简单使用
1;在布局文件中申明,并在TabLayout下面放ViewPager
android:id="@+id/Tablayout1"
app:tabMode="scrollable"
app:tabSelectedTextColor="@color/colorPrimary"
app:tabIndicatorColor="@color/colorPrimary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
android:id="@+id/vp_main"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight = "1"
/>
2:在JAVA文件中找出控件
mTablayout = (TabLayout) findViewById(R.id.Tablayout1);
mVp_main = (ViewPager) findViewById(R.id.vp_main);
3:为ViewPager设置适配器,适配器应该继承FragmentPagerAdapter,大致和普通的ViewPager 适配器差不多,多了最后一个方法,每个Vi