如何让视图保留在列表的开头?
我尝试了scrollTo(0,0)
,但似乎没有用。
编辑: 我的recyclerview imp ..
newsFeedView.setHasFixedSize(false);
newsFeedView.setLayoutManager(
new LinearLayoutManager(this.getActivity(), LinearLayoutManager.VERTICAL, true));
FirebaseRecyclerAdapter<NewsFeed, NewsFeedHolder> mAdapter;
mAdapter = new FirebaseRecyclerAdapter<NewsFeed, NewsFeedHolder>(NewsFeed.class,
R.layout.item_newsfeed, NewsFeedHolder.class,
database.child("posts").orderByChild("timeCreated")) {...}
<android.support.v7.widget.RecyclerView
android:id="@+id/detail_comments_view"
android:layout_width="0dp"
android:layout_height="295dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:clickable="true"
android:windowSoftInputMode="adjustResize"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/details_cv"
android:layout_marginBottom="0dp"
app:layout_constraintBottom_toTopOf="@+id/comment_test_button"
/>
如果您需要更多
,请告诉我答案 0 :(得分:0)
我不得不改变
new LinearLayoutManager(this.getActivity(), LinearLayoutManager.VERTICAL, false));
并添加
.setReverseLayout(true);
.setStackFromEnd(true);