我在ScrollView中使用了RecyclerView
<Scrollview
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:id="@+id/layoutStaticContent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
//Static content.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="100dp">
.
.
<LinearLayout>
//Dynamic content(newsfeed)
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</ScrollView>
现在在滚动时,layoutStaticContent固定在顶部,而recyclerview内容独立地在底部滚动。 如何滚动整个内容即(layoutStaticContent + recyclerview内容),以便只有1个scrollview? 我也尝试用Nestedscrollview替换scrollview,但没有成功。
androidx.core.widget.NestedScrollView
。 - Francis Laclé