先看效果图:
使用tablayout,首先需要在项目中加入design包
dependencies {
compile 'com.android.support:design:24.1.1'
}
在activity_main.xml布局文件中
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="zhengliang.com.tablayout.mainactivity">
android:id="@+id/tab"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colo