scwang90 / SmartRefreshLayout

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

无法刷新或加载更多 #88

Closed DCRain closed 7 years ago

DCRain commented 7 years ago

SmartRefreshLayout中包含ListView,当ListView内容为空的时候,不能刷新也不能加载更多。 mListView.setNestedScrollingEnabled(false)也不能解决问题。代码如下:


    <com.scwang.smartrefresh.layout.SmartRefreshLayout xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/mRefreshView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:srlDisableContentWhenRefresh="true"
        app:srlEnableAutoLoadmore="false"
        app:srlEnableHeaderTranslationContent="false"
        app:srlEnableLoadmore="true">

        <ListView
            android:id="@+id/mListView"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

    </com.scwang.smartrefresh.layout.SmartRefreshLayout>
scwang90 commented 7 years ago

你所描述的问题无法重现

zhuozhao commented 7 years ago

确实存在这个问题,当分页显示,有些手机屏幕长,第一页数据没显示全屏,导致加载更多不触发 `<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="40dp">

    <TextView
        android:id="@+id/startTv"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:background="@drawable/com_item_selector"
        android:clickable="true"
        android:drawableRight="@drawable/arrow_down_gray"
        android:gravity="center" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:background="@color/white"
        android:gravity="center"
        android:text="@string/zhi" />

    <TextView
        android:id="@+id/endTv"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:background="@drawable/com_item_selector"
        android:clickable="true"
        android:drawableRight="@drawable/arrow_down_gray"
        android:gravity="center" />

    <View
        android:layout_width="1px"
        android:layout_height="match_parent"
        android:layout_marginBottom="5dp"
        android:layout_marginTop="5dp"
        android:background="@color/gray" />

    <TextView
        android:id="@+id/companyTv"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:background="@drawable/com_item_selector"
        android:clickable="true"
        android:drawableRight="@drawable/arrow_down_gray"
        android:gravity="center" />

</LinearLayout>

<View
    android:layout_width="match_parent"
    android:layout_height="1px"
    android:background="@color/gray" />

<com.scwang.smartrefresh.layout.SmartRefreshLayout
    android:id="@+id/refreshLayout"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1"
    >

    <ListView
        android:id="@+id/listView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:nestedScrollingEnabled="false"/>

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

` image

scwang90 commented 7 years ago

@zhuozhao 看 常见问题 #71

shijunxing0130 commented 7 years ago

解决了吗,我也遇到这问题

zhuozhao commented 7 years ago

image https://github.com/scwang90/SmartRefreshLayout/blob/master/art/md_property.md 我在属性方法里找到了改配置,希望作者把改配置默认开启,thanks~

shijunxing0130 commented 7 years ago

能下拉刷新吗

quanqiuheike commented 7 years ago

下拉刷新有时候调用了,有时候不调用

scwang90 commented 7 years ago

@quanqiuheike 使用 1.0.4-alpha-0 版本

quanqiuheike commented 7 years ago

下拉刷新有时候调用了,有时候不调用,有刷新的效果

之前使用的1.03-alpha-6的版本,平时测试的时候没有注意这个问题呢,抓包没有看到调用,重新debug就正常了,然后数据源为空的时候就没有调用,debug的时候都没有走到,结果今天发现了,然后跟现在的正式版本比对一下,后面改为稳定版本就可以了,感谢大神。