回收器视图项如果其置于“刷卡刷新布局-Android”下,则单击“不工作”
如果我将recycler视图放在刷卡刷新布局中,则recycler视图项目单击“不工作”。添加下面的布局回收器视图项如果其置于“刷卡刷新布局-Android”下,则单击“不工作”,android,android-recyclerview,onclicklistener,swiperefreshlayout,Android,Android Recyclerview,Onclicklistener,Swiperefreshlayout,如果我将recycler视图放在刷卡刷新布局中,则recycler视图项目单击“不工作”。添加下面的布局 <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ap
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/tv_no_order"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="90dp"
android:layout_marginEnd="90dp"
android:gravity="center_horizontal"
android:lineSpacingExtra="6sp"
android:text="@string/no_orders_found"
android:textColor="#616161"
android:textSize="16sp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<include
android:id="@+id/progressView"
layout="@layout/layout_progress"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh_layout"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0"
android:clickable="false">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rcv_inventory"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:padding="@dimen/padding_15dp"
android:focusable="true" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
当我删除“滑动刷新”布局时,这些单击会起作用。如何在不删除刷卡刷新布局的情况下使回收器视图可单击
更多信息:此布局是片段的一部分,片段用作第2页的查看页面。我在回收器视图适配器中有两种视图类型尝试使用LinearLayout替换ConstraintLayout
尝试使用LinearLayout替换ConstraintLayout
SwipeRefreshLayout不应阻止RecyclerView项接收单击事件,您是否也可以发布itemClickListener实现
也可以考虑使用FraselayOutt来满足上面的布局要求。
SyfReFrSHead不应该是RealReVIEW项接收CKET事件的拦截器,也可以发布ItCurkListInter实现吗?
也可以考虑使用FrAMLAYOUT用于上面的布局要求。
使用约束布局的最新稳定版本。我有同样的问题,因为我使用的是旧版本 使用约束布局的最新稳定版本。我有同样的问题,因为我使用的是旧版本谢谢,将约束布局替换为框架布局:谢谢,将约束布局替换为框架布局:谢谢,通过将约束布局替换为框架布局解决了问题。谢谢,通过将约束布局替换为框架布局解决了问题。
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/tv_no_order"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="90dp"
android:layout_marginEnd="90dp"
android:gravity="center_horizontal"
android:lineSpacingExtra="6sp"
android:text="@string/no_orders_found"
android:textColor="#616161"
android:textSize="16sp"
android:visibility="gone"
/>
<include
android:id="@+id/progressView"
layout="@layout/layout_progress"
android:visibility="gone"
/>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rcv_inventory"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/padding_15dp"
/>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</LinearLayout>
dependencies {
implementation "androidx.constraintlayout:constraintlayout:2.0.4"
}