私はLinearLayout
にネストされたRecyclerView
の項目リストを表示しています。 RecyclerView
(アイテムまたは背景の白い部分のいずれか)がクリックされたときにポップアップを開こうとしていますが、通常はsetOnClickListener
が機能しません。Recyclerviewはクリックできません
もちろん、アイテムごとにクリックリスナーを置くことはできますが、その間の白い部分はクリック不可能なままです。
RecyclerView
エリア全体をクリック可能にする方法はありますか?
EDIT:サンプルコードを追加しました。ポップアップを開くためにレイアウト全体をクリック可能にしたいのですが、最初の3つのビューが正しく動作している間は、RecyclerViewは動作しません。
<LinearLayout
android:id="@+id/layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="@dimen/spacing_half"
android:background="@color/color_item_margin_divider"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/fragment_tags_title"
style="@style/ItemFragmentHeader"/>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/spacing_line"
android:background="@color/color_line_divider"/>
<RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/spacing_half"/>
</LinearLayout>
申し訳ありませんが、しかし...? – Alessandro
コードを投稿する必要があります。また、クリックイベントをキャプチャする可能性があるため、親ビューを確認してください。 'android:clickable =" true "'を親のXMLに追加することでそれを無効にすることができます。 – C0D3LIC1OU5
いくつかのコードを投稿してください。 –