scwang90 / SmartRefreshLayout

🔥下拉刷新、上拉加载、二级刷新、淘宝二楼、RefreshLayout、OverScroll,Android智能下拉刷新框架,支持越界回弹、越界拖动,具有极强的扩展性,集成了几十种炫酷的Header和 Footer。
https://segmentfault.com/a/1190000010066071
Apache License 2.0
24.8k stars 4.93k forks source link

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

Open s2405330 opened 6 years ago

s2405330 commented 6 years ago

如题

这是布局代码 `<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));

scwang90 commented 6 years ago

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

liuxuesong001 commented 5 years ago

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

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

wjk2813 commented 4 years ago

同样问题。

zhupengxiang commented 4 years ago

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

zhupengxiang commented 4 years ago

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

kyriej commented 3 years ago

问题加一

xuzhu19930323 commented 1 year ago

同样问题,SmartRefreshLayout嵌套CoordinatorLayout, CoordinatorLayout最下面放的一个FrameLayout,用来动态替换成Fragment显示列表,不能加载更多,应该是嵌套的问题,你们有解决的吗