RecyclerView高度wrap_content计算不正确

And*_*rei 5 android android-scrollview android-recyclerview android-wrap-content

我想要我RecyclerViewwrap_content.我不希望在RecyclerView中滚动任何内容,它应该调整到内部孩子的高度.我不想让我的父ScrollView滚动我的活动内容.

<FrameLayout
  android:layout_width="match_parent"
  android:layout_height="match_parent">
  <!-- scrolls a little bit as RecyclerView goes slightly down beyond the screen -->
  <ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <LinearLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical">
      <!-- still scrolls inside -->
      <android.support.v7.widget.RecyclerView
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
Run Code Online (Sandbox Code Playgroud)

填充RecyclerView:

myAdapter = new MyAdapter();
layoutManager = new LinearLayoutManager(this);
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
mRecyclerView.setAdapter(myAdapter);
Run Code Online (Sandbox Code Playgroud)

我使用RecyclerView库来wrap_content解决问题:

dependencies {
    compile 'com.android.support:recyclerview-v7:25.0.0'
}
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

基本上,RecyclerView高度计算对我来说效果不佳.RecyclerView仍然有它自己的滚动和ScrollView滚动一点.如果我尝试将一些rediculous RecyclerView高度设置为1000dp,使其大于项目总高度,则滚动按需工作,例如RecyclerView不滚动,ScrollView使用所有RecyclerView项目滚动活动.

那我做错了什么?:)

And*_*rei 4

我需要的只是使用android.support.v4.widget.NestedScrollView而不是 ScrollView。