【发布时间】:2017-03-18 20:10:58
【问题描述】:
如何让视图保持在列表的开头?
我尝试过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"
/>
如果您需要更多,请告诉我
【问题讨论】:
-
考虑添加一些代码,以便我们更好地帮助您...
-
你确定你没有添加一些让recyclerview自动滚动的代码吗?
-
是的,我很确定我对我的房车的所有呼叫都与此无关
标签: android firebase firebase-realtime-database android-recyclerview