【发布时间】:2015-11-30 09:06:34
【问题描述】:
所以我在垂直 ScrollView 中有一个水平 RecyclerView。我的布局中的所有内容都显示得很好,并且都按照我想要的方向滚动,并且运行顺畅。
我唯一的问题是,RecyclerView 位于 ScrollView 中的其他内容下方,当 RecyclerView 部分可见时,它会在启动时将 RecyclerView 的底部与屏幕底部对齐。这意味着 RecyclerView 上方的内容被推离了屏幕。
有谁知道为什么会发生这种情况,我该如何解决?
这是一个简单的布局,可以实现我刚才描述的功能。您甚至不需要填充 RecyclerView,它仍然会这样做。
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="500dp"
android:background="#fff"/>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="200dp"
android:background="#000"/>
</LinearLayout>
</ScrollView>
【问题讨论】:
-
据我对 TwoWayView 的了解,它与我的问题并不真正相关,但无论如何谢谢。
标签: android scrollview android-recyclerview