Android 如何在NestedScrollView中聚焦RecyclerView顶部位置?
无法将Android 如何在NestedScrollView中聚焦RecyclerView顶部位置?,android,android-layout,android-recyclerview,android-nestedscrollview,Android,Android Layout,Android Recyclerview,Android Nestedscrollview,无法将recyclerview顶部位置置于NestedScrollView内 我有以下xml文件的结构 <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.v4.widget.NestedScrollView android:layout_alignParentTop="t
recyclerview
顶部位置置于NestedScrollView
内
我有以下xml文件的结构
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.NestedScrollView
android:layout_alignParentTop="true"
android:id="@+id/nested_scroll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/cv_comment_post">
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
card_view:cardCornerRadius="@dimen/_2dp">
<!-- Some Views of -->
</android.support.v7.widget.CardView>
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/card_view" />
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
mRecyclerView.scrollToPosition(0);