cundong / HeaderAndFooterRecyclerView

A RecyclerView solution, support addHeaderView、addFooterView
Apache License 2.0
1.37k stars 321 forks source link

加载第一页 会向上跳动 这是什么原因? #35

Open sunqi1006 opened 8 years ago

BryceLee commented 7 years ago

同问!

CodeIdeal commented 7 years ago

@sunqi1006 @Hellozhongxin 应该是你们在数据加载成功后调用了RecyclerViewStateUtils.setFooterViewState()方法,这方法里会调一下recyclerView.scrollToPosition(headerAndFooterAdapter.getItemCount() - 1); 把RecyclerView滑动到底部。

CodeIdeal commented 7 years ago

@sunqi1006 @Hellozhongxin 可以在调用recyclerView.scrollToPosition(headerAndFooterAdapter.getItemCount() - 1);前加一个判断,如果是normal就不跳转