anzaizai / EasyRefreshLayout

Inherited This library allows you to easily achieve the drop-down refresh and upload more

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

method 'setRefreshing' is invalid

foreverGoUp opened this issue · comments

刚进入界面时我需要先自动刷新一次数据,刷新时间为5s,所以我要手动设置正在刷新让用户知道正在刷新数据中,而不需要用户首次在空白的界面上手动下拉刷新触发,然而我调用了setRefreshing却没有看到“正在刷新”的头部显示出来。

public void autoRefresh() {
autoRefresh(500);
}

/**
 * 在onCreate中调用autoRefresh,此时View可能还没有初始化好,需要延长一段时间执行。
 *
 * @param duration 延时执行的毫秒值
 */
public void autoRefresh(long duration) {
    if (state != State.RESET) {
        return;
    }
    postDelayed(autoRefreshRunnable, duration);
}你可以调用这两个,注意最好在onresume处调用

天哪!我以为autoRefresh这个方法只要设置了之后,就会按照默认间隔自动刷新,所以才没想到用这个方法调用实现效果。作者大大可以考虑换个不容易混淆的名字(笑哭)