Android 具有0dp高度的RecyclerView Inner ConstraintLayout不调用适配器&;持有人
Im使用带有PagedListAdpter的RecyclerView 如果我使用Android 具有0dp高度的RecyclerView Inner ConstraintLayout不调用适配器&;持有人,android,android-recyclerview,android-constraintlayout,android-pagedlistview,Android,Android Recyclerview,Android Constraintlayout,Android Pagedlistview,Im使用带有PagedListAdpter的RecyclerView 如果我使用MATCH\u PARENT设置recyclerView的高度和宽度,adapter.submitList(someList)可以正常工作, 但是,如果我将height&width设置为0dp(对于constraintLayout)则不起作用,适配器和ViewHolder中的方法不会被调用 约束布局内部是否有错误 下面的XML代码: <?xml version="1.0" encoding=
MATCH\u PARENT
设置recyclerView的高度和宽度,adapter.submitList(someList)
可以正常工作,
但是,如果我将height&width设置为0dp(对于constraintLayout)
则不起作用,适配器和ViewHolder中的方法不会被调用
约束布局内部是否有错误
下面的XML代码:
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/search_result_root"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/search_input_layout"
android:layout_width="match_parent"
android:layout_height="60dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/search_input"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/search_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="tasdf"
app:layout_constraintBottom_toBottomOf="@id/search_input"
app:layout_constraintRight_toRightOf="@id/search_input"
app:layout_constraintTop_toTopOf="@id/search_input" />
</RelativeLayout>
<Spinner
android:id="@+id/search_options"
android:layout_width="60dp"
android:layout_height="30dp"
android:background="@color/color_transparent"
android:spinnerMode="dropdown"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/search_input_layout" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/search_recyclerview"
android:layout_width="0dp"
android:layout_height="0dp"
android:clipToPadding="false"
android:paddingLeft="10dp"
android:paddingTop="20dp"
android:paddingRight="10dp"
android:paddingBottom="20dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/search_options" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>