为什么RecyclerView在轮换后恢复其状态?

时间:2017-03-06 10:04:30

标签: android android-recyclerview layout-manager screen-rotation savestate

RecyclerViewFragmentViewPager处理。如何使RecyclerView 自动在轮换后恢复其状态?我以为我必须实施

LayoutManager.onSaveInstanceState()
LayoutManager.onRestoreInstanceState(Parcelable state);
我自己。 LayoutManagerRecyclerView是否会注册某种onConfigurationChange接收方?

1 个答案:

答案 0 :(得分:1)

RecyclerView扩展了ViewGroup,因此扩展了View。

如果您在RecyclerView上添加了ID,

  

的onSaveInstanceState / onRestoreInstanceState

将会致电。

链接:RecyclerView store / restore state between activities