视频预览:
回收者的观点有时无处不在,有时甚至消失。
有人可以向我解释为什么会这样吗?
postAdapter = new PostAdapter(getActivity(), postList, userPreferences);
linearLayoutManager = new LinearLayoutManager(getActivity());
linearLayoutManager.setReverseLayout(true);
linearLayoutManager.setStackFromEnd(true);
recyclerView.setLayoutManager(linearLayoutManager);
recyclerView.setAdapter(postAdapter);
pullRefreshLayout.setRefreshing(true);
@Override
public void onChildAdded(@NonNull DataSnapshot dataSnapshot, String previousChildName) {
Post p = dataSnapshot.getValue(Post.class);
postKeys.add(dataSnapshot.getKey());
postList.add(p);
postAdapter.notifyItemInserted(postList.size() - 1);
pullRefreshLayout.setRefreshing(false);
}