BottomTabBar 套用 recycleview出错问题

原来不是用这个框架的 是一个不知名的github开源类  开始感觉很不错 后来套用recycleview就出错应该是碎片关系没处理好 ,后来用bottomtabbar    他的傻逼思想深深撼动了我,因此bottombar也出错 导致我写这篇文章(本人小白尽全力描述遇到的问题)

BottomTabBar  封装的相当不错了,个人感觉 关于fragment 他封装很好懒人加载 点哪一行才会请求网络而且只请求一次

说布局

activity_main.xml  这里不需要写什么固定的 你只要把  BottomTabBar 标签加进去 其他的布局写的你fragment里面

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">


<com.hjm.bottomtabbar.BottomTabBar
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/bottom_bar">
</com.hjm.bottomtabbar.BottomTabBar>

    <!--<com.stdu.x5.utils.BottomBar-->
        <!--android:background="#CD2990"-->
        <!--android:id="@+id/bottom_bar"-->
        <!--android:layout_width="match_parent"-->
        <!--android:layout_height="48dp"-->
        <!--android:layout_gravity="bottom" />-->

</LinearLayout>

fragment 里面的layout

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    >


        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/firstpagerecycler_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            >
        </androidx.recyclerview.widget.RecyclerView>




</FrameLayout>

关于mainactivity类里面  没毛病 不会的自行百度

原文地址:https://www.cnblogs.com/xuexidememeda/p/10353829.html