SmartRefreshLayout 用在CoordinatorLayout外部的时候 为什么不能加载更多了

oxf4rvwz  于 2022-11-05  发布在  其他
关注(0)|答案(6)|浏览(484)

如题

这是布局代码
`<com.scwang.smartrefresh.layout.SmartRefreshLayout
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:id="@+id/refreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:srlAccentColor="@android:color/white"
app:srlPrimaryColor="@android:color/holo_green_light">

<android.support.design.widget.CoordinatorLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.scwang.refreshlayout.activity.using.MyCustomActivity">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/app_bar"
        android:layout_width="match_parent"
        android:layout_height="@dimen/app_bar_height"
        android:fitsSystemWindows="true"
        android:theme="@style/AppTheme.AppBarOverlay">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/toolbar_layout"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fitsSystemWindows="true"
            app:contentScrim="?attr/colorPrimary"
            app:layout_scrollFlags="scroll|exitUntilCollapsed"
            app:toolbarId="@+id/toolbar">

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:layout_collapseMode="pin"
                app:popupTheme="@style/AppTheme.PopupOverlay"/>

        </android.support.design.widget.CollapsingToolbarLayout>
    </android.support.design.widget.AppBarLayout>

    <include layout="@layout/content_my_custom"/>//这里面是个scrollview

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/fab_margin"
        app:layout_anchor="@id/app_bar"
        app:layout_anchorGravity="bottom|end"
        app:srcCompat="@android:drawable/ic_dialog_email"/>

</android.support.design.widget.CoordinatorLayout>

</com.scwang.smartrefresh.layout.SmartRefreshLayout>`

activity中的代码是这样的
mRefreshLayout = (RefreshLayout) findViewById(refreshLayout); mRefreshLayout.setOnRefreshLoadMoreListener(this); mRefreshLayout.setRefreshHeader(new ClassicsHeader(this)); mRefreshLayout.setRefreshFooter(new ClassicsFooter(this));

e5njpo68

e5njpo681#

嵌套滚动 demo 中有例子的,例子-潜逃滚动-整体嵌套,好好对比一下,你提供的代码也没看出什么问题

llycmphe

llycmphe2#

用在CoordinatorLayout外部的时候 为什么不能加载更多了:
NestedViewPager 嵌套 ("ViewPager", NestedScrollExampleFragmentViewPager.class);
Demo 里边是用adaprer 实现了上拉 操作。
请看我的问题布局代码,我想实现,在在外层实现下拉刷新,然后,根据viewpager 里边的数据自动加载更多。

<com.zhy.autolayout.AutoLinearLayout xmlns:android=" http://schemas.android.com/apk/res/android "
xmlns:app=" http://schemas.android.com/apk/res-auto "
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<com.scwang.smartrefresh.layout.SmartRefreshLayout
    android:id="@+id/swipe_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/white"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    app:srlEnableAutoLoadMore="false"
    app:srlEnableFooterTranslationContent="true">

    <com.scwang.smartrefresh.header.MaterialHeader
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

    </com.scwang.smartrefresh.header.MaterialHeader>

    <android.support.design.widget.CoordinatorLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <android.support.design.widget.AppBarLayout
            android:id="@+id/appBarLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@android:color/transparent"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

            <android.support.design.widget.CollapsingToolbarLayout
                android:id="@+id/collapse_toolbar"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@android:color/transparent"
                app:contentScrim="@android:color/transparent"
                app:layout_scrollFlags="scroll|exitUntilCollapsed">

                <include layout="@layout/include_sm_header" />

                <include layout="@layout/include_title_sm" />

                <com.rainxing.shzzzfd.mvp.weiget.tablayout.TabLayout
                    android:id="@+id/tab_layout"
                    android:layout_width="match_parent"
                    android:layout_height="40dp"
                    android:layout_gravity="bottom|center"
                    android:background="@android:color/white"
                    android:gravity="center"
                    app:tabGravity="center"
                    app:tabIndicatorColor="@color/color_2A67FF"
                    app:tabIndicatorHeight="3dp"
                    app:tabMode="fixed"
                    app:tabSelectedTextColor="@android:color/black"
                    app:tabTextAppearance="@style/tab_appearance_sm"
                    app:tabTextColor="@color/color_333333" />

            </android.support.design.widget.CollapsingToolbarLayout>

        </android.support.design.widget.AppBarLayout>

        <android.support.v4.view.ViewPager
            android:id="@+id/view_pager"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:layout_behavior="@string/appbar_scrolling_view_behavior" />

    </android.support.design.widget.CoordinatorLayout>

    <com.scwang.smartrefresh.header.MaterialHeader
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

    </com.scwang.smartrefresh.header.MaterialHeader>

</com.scwang.smartrefresh.layout.SmartRefreshLayout>

</com.zhy.autolayout.AutoLinearLayout>

现在的问题就是底部控件不显示,无法加载更多。

px9o7tmv

px9o7tmv4#

我也是SmartRefreshLayout嵌套CoordinatorLayout不能实现加载更多 @liuxuesong001@wjk2813 请问解决了吗

clj7thdc

clj7thdc5#

我是SmartRefreshLayout嵌套CoordinatorLayout, CoordinatorLayout最下面放的recyclerview

相关问题