问题:页面切换时为什么会自动跳到 recyclerView 的位置
我是这么解决的( 亲测有效 ),在外面嵌套一层 RelativeLayout :
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:overScrollMode="never"/>
</RelativeLayout>
红色部分为关键代码;红色代码的意思是,覆盖子类控件直接获得焦点 。
更多好内容戳下面: