使用viewpager+CommonTabLayout上图下文底部导航栏
第一步 导入CommonTabLayout依赖
implementation ‘com.flyco.tablayout:FlycoTabLayout_Lib:2.0.2@aar’
第二步 创建布局
// An highlighted block
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent"
tools:context=".MainActivity">
<androidx.viewpager.widget.ViewPager
android:layout_weight="1"
android:id="@+id/vp"
android:layout_height="0dp"
android:layout_width="match_parent">
</androidx.viewpager.widget.ViewPager>
<com.flyco.tablayout.CommonTabLayout
android:layout_width="match_parent"
android:id="@+id/tab"
app:tl_textSelectColor="#0077F3"
app:tl_textUnselectColor="#000"
android:layout_height="50dp">
</com.flyco.tablayout.CommonTabLayout>
</LinearLayout>
第三步 创建一个类实现CustomTabEntity接口
// An highlighted block
/**
* @author
* @description: 封装的CustomTabEntityDemo类
* @date
*/
public class CustomTabEntityDemo implements