Aspsine / IRecyclerView

IRecyclerView is a custom RecyclerView that supports pull-to-refresh, pull-to-loadmore, customize refresh header and loadmore footer, add header views and footer views.
730 stars 146 forks source link

不需要footer的时候,设置LoadMoreFooterView.Status.GONE,fooder高度依然存在 #34

Closed lucky0719 closed 7 years ago

lucky0719 commented 7 years ago

LoadMoreFooterView loadMoreFooterView = (LoadMoreFooterView) iRecyclerView.getLoadMoreFooterView();

loadMoreFooterView.setStatus(LoadMoreFooterView.Status.GONE)

当我不需要footer的时候只需要刷新的时候 使用该方法 虽然gone掉了 但是高度footer的高度依然存在

如果我在xml里面把 app:loadMoreEnabled="true" app:loadMoreFooterLayout="@layout/layout_irecyclerview_footer" 去掉,在post自动刷新后,看不见刷新header,怎么办?

Aspsine commented 7 years ago

LoadMoreFooterView 位于 com.aspsine.irecyclerview.demo.ui.widget.footer 是可以自己实现的。

private void change() {
        switch (mStatus) {
            case GONE:
                mLoadingView.setVisibility(GONE);
                mErrorView.setVisibility(GONE);
                mTheEndView.setVisibility(GONE);
                setVisibility(GONE); // 添加这句
                break;

            case LOADING:
                mLoadingView.setVisibility(VISIBLE);
                mErrorView.setVisibility(GONE);
                mTheEndView.setVisibility(GONE);
                break;

            case ERROR:
                mLoadingView.setVisibility(GONE);
                mErrorView.setVisibility(VISIBLE);
                mTheEndView.setVisibility(GONE);
                break;

            case THE_END:
                mLoadingView.setVisibility(GONE);
                mErrorView.setVisibility(GONE);
                mTheEndView.setVisibility(VISIBLE);
                break;
        }
    }