-2

I have implemented RecyclerView, and for each recyclerView item i have GridView and it's corresponding adapter.

When i am trying to listen to the recyclerView onClick() item, it listening to the click event for whole area except the area or space taken by the gridView.

public ChildViewHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
            itemView.setOnClickListener(this);
        }

        @Override
        public void onClick(View v) {
            if(hallNameAdapter != null){
                Adapter adapter = (Adapter) hallName.getTag();
                if(showMovieTimeAdapter != null){
                    adapter.onHallClick();
                }
            }
        }

Child View Holder Xml.

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:background="#FFFFFF"
    android:layout_height="match_parent">
    <com.movie.bms.utils.customcomponents.TextViewRoboto
        android:id="@+id/show_time_fragment_cinema_hall_name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="20.9dp"
        app:textStyle="roboto_medium"
        android:textSize="16dp"
        android:textColor="#555555"
        android:layout_marginTop="12dp" />
    <LinearLayout
        android:id="@+id/show_time_fragment_images_lin_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="11.3dp"
        android:layout_below="@id/show_time_fragment_cinema_hall_name"
        android:orientation="horizontal">
        <ImageView
            android:id="@+id/show_time_fragment_reserve_image"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="20.9dp" />
        <ImageView
            android:id="@+id/show_time_fragment_m_ticket_image"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="20.9dp"
            />
    </LinearLayout>
    <com.movie.bms.utils.customcomponents.CustomGridView
        android:id="@+id/show_movie_timings_grid_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/show_time_fragment_images_lin_layout"
        android:layout_marginLeft="20.9dp"
        android:layout_marginTop="13.3dp"
        android:verticalSpacing="12dp"
        android:layout_marginRight="10dp"
        android:columnWidth="100dp"
        android:stretchMode="columnWidth"
        android:gravity="center"
        android:horizontalSpacing="10dp"
        android:numColumns="4"
        >
    </com.movie.bms.utils.customcomponents.CustomGridView>
    <View
        android:id="@+id/show_time_fragment_separator"
        android:layout_below="@id/show_movie_timings_grid_view"
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:layout_marginTop="20dp"
        android:background="#79d6d6d6"/>
</RelativeLayout>

Any help or suggestions would be appreciated on this.

Ritesh
  • 2,558
  • 2
  • 15
  • 38

1 Answers1

-1

RecyclerView doesnt have a onItemClickListener like listview or gridview

u Have to set a onCLickListener in the viewHolder of your recyclerview adapter

JAAD
  • 12,171
  • 6
  • 34
  • 56