Tôi sử dụng RecyclerView để hiển thị danh sách các mục. Mỗi mục lưu trữ một RecyclerView khác là danh sách hình ảnh.
Bây giờ tôi muốn làm cho RecyclerView lồng nhau này có thể nhấp được, không phải trên các mục của nó mà trên toàn bộ Chế độ xem.
Làm thế nào tôi có thể làm điều này?
câu hỏi:
- Đặt onClickListener cho chế độ xem chính của RecyclerView lồng nhau sẽ hoạt động nhưng chỉ khi tôi nhấp vào bên ngoài RecyclerView
- Việc nhấp vào RecyclerView lồng nhau không chuyển lần nhấp sang Chế độ xem gốc (Tôi thậm chí đã thử đặt có thể nhấp, có thể lấy tiêu điểm, có thể lấy nétIntouch thành sai, tuy nhiên, thao tác chạm không được ủy quyền mà được sử dụng bởi RecyclerView lồng nhau.. .<
Đây là Chế độ xem bao bọc bộ chuyển đổi:
<>
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
card_view:cardCornerRadius="0dp"
android:layout_margin="5dp"
android:foreground="?android:attr/selectableItemBackground" >
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:id="@+id/rlTop"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="ngang">
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="Dữ liệu"
android:textStyle="đậm"
android:id="@+id/tvDate" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="Thông tin"
android:id="@+id/tvInfo" />
<>
android:id="@+id/rvData"
android:có thể nhấp được="false"
android:focusableInTouchMode="false"
android:có thể lấy nét="false"
android:layout_below="@+id/rlTop"
android:layout_width="match_parent"
android:layout_height="68dp"
android:scrollbars="ngang" />
Tôi đã xem mã nguồn RecyclerView và điều này đã giúp:
RecyclerView.setLayoutFrozen(true)
Về android - RecyclerView với RecyclerView lồng nhau - làm cho RecyclerView lồng nhau có thể nhấp được dưới dạng toàn bộ Chế độ xem, chúng tôi đã tìm thấy một câu hỏi tương tự trên Stack Overflow: https://stackoverflow.com/questions/30762722/
Tôi là một lập trình viên xuất sắc, rất giỏi!