效果图如下
首先,要使用控件需要添加design library,在Android Studio中添加
compile 'com.android.support:design:23.4.0'
然后是布局文件<?xml version="1.0" encoding="utf-8"?>
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context="com.lg.tablayoutdemo.MainActivity">
android:id="@+id/tab_layou"
android:layout_width="match_parent"
app:tabIndicatorColor="@android:color/holo_blue_light"
app:tabTextColor="@