这是一个XML,当我使用ScrollView在回收器下方查看时,不会出现回收器视图
RecyclerView,如果不在XML中使用ScrollView,则会出现回收器下方查看
那么原因是什么呢?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include
android:id="@+id/toolbar"
layout="@layout/toolbar_main" />
<LinearLayout
android:layout_width="match_parent"
android:layout_below="@+id/toolbar"
android:id="@+id/lind"
android:layout_height="wrap_content">
.....
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/lind"
android:id="@+id/linearLayout2"
android:layout_marginTop="10dp"
android:gravity="center_horizontal"
android:orientation="horizontal">
.....
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:layout_marginTop="5dp"
android:id="@+id/linearLayout3"
android:layout_below="@+id/linearLayout2"
android:orientation="horizontal">
.....
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/my_recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none"
android:layout_below="@+id/linearLayout4"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/linearLayout4"
android:orientation="horizontal"
android:layout_marginLeft="5dp"
android:layout_marginRight="10dp"
android:layout_below="@+id/linearLayout3"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
......
</RelativeLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/below_recycler_view"
android:layout_width="match_parent"
android:layout_below="@+id/my_recycler_view"
android:layout_height="wrap_content"
android:scrollbars="none" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>
您不能将ListView/RecycleView
放入ScrollView
中。当ListView
和RecycleView
试图计算它们的高度时,它们使用的是父高度ScrollView
没有指定的高度,因此它给出了一个错误。
我在ScrollView中有一个这样的RecyclerView: 的项目是一个,其中有一个和其他视图。该和的都是。用户可以在没有任何长度/行限制的情况下输入到该中,以便每个项目的高度都不同。 然后我发现中的返回真值,但调用的时间错误(少于应有的时间),因此不足以显示所有项目。 我发现只有当我编写了时才会发生这种情况。但是我不能删除这一行。因为如果我这样做了,将无法流畅滚动,并且与和本身内的其他视图
我在StackOverflow上看到了一些类似的事件。然而,这些似乎都不适用于我的情况。我遇到的问题是,我的RecyclerView正在工作,但没有显示任何内容。我已经运行了多个测试,试图找出它不工作的原因,但所有测试都支持它正常工作的事实。 getItemCount中的日志返回3,这是正确的数字。我只是不明白为什么它没有显示。我回头看了我在以前的活动中做的回收器视图,它们都在一定程度上匹配(其他
我试图在滚动视图中显示水平的recyclerview项和垂直的recyclerview项 即使我使用android:fillViewport=“true”,Scrollview也无法工作
如何使用网格布局管理器水平显示三行三列的循环视图项目,增加垂直增加的价值,类似于下图
我正在使用最新的支持设计(),23.2版本中的支持设计应该已经解决了ScrollView内部的RecyclerView问题。RecyclerView和ExpandableListView滚动都能很好地工作。但是当ExpandableListView太长时,我希望能够向上滚动布局,以便可以看到其余部分时,scrollview就无法工作。 片段: xml:
我想单击按钮将添加到中,但未调用适配器的实现方法。 这是我的代码: CourseDetailAdapter。班 我想为输入数据添加layout,所以我不确定是否正确