【发布时间】:2019-05-11 09:39:08
【问题描述】:
我知道我们可以使用 notifyDataSetChanged() 方法向 recyclerview 添加新元素并更新视图,但我需要平滑过渡。
当我尝试使用带有LinearInterpolator的Transition时,我可以达到效果,但是滚动会自动跳转到更新列表的最后一个位置,我需要避免这种情况。
moreButtonClicked(){
viewMore.setVisibility(View.GONE);
rcAdapter.moreClicked = true;
rcAdapter.notifyDataSetChanged();
Transition changeBounds = new ChangeBounds();
changeBounds.setDuration(3000);
changeBounds.setInterpolator(new LinearInterpolator() );
TransitionManager.beginDelayedTransition(myCityList,changeBounds);
}
此代码使其自动滚动到 recyclerview 的最后一项。关于这个问题的另一件事是它只在某些时候发生。我需要提一下,我的 recyclerview 在 Nestedscrollview 中
【问题讨论】:
标签: java android user-interface