title: Setting OnClickListener on RecyclerView itself not on item
body: <p>I want to set an <code>OnClickListener</code> on a <code>RecyclerView</code>, <strong>not on its items</strong> so that it triggers a click event when the user clicks on the <code>RecyclerView</code> (even if it is empty or full of items).</p>
  <ul>
  <li>I'm using MVVM</li>
  <li>I tried <code>mRecyclerView.setClickable(true)</code>, not working</li>
  </ul>
  <p><strong>What I want</strong></p>
  <pre><code>mRecyclerView.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View v) {
          // do something
      }
  });
  </code></pre>
  <p><strong>My Adapter Class</strong></p>
  <pre><code>public class TaskItemAdapter extends RecyclerView.Adapter&lt;TaskItemAdapter.BaseItemAdapterViewHolder&gt; {
      private static final String TAG = TaskItemAdapter.class.getSimpleName();
      private List&lt;Task&gt; mTaskList;
      private View.OnLongClickListener mOnLongClickListener;
  
      public TaskItemAdapter(List&lt;Task&gt; taskList, View.OnLongClickListener longClickListener) {
          mTaskList = taskList;
          mOnLongClickListener = longClickListener;
      }
  
      @NonNull
      @Override
      public BaseItemAdapterViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
          if (parent instanceof RecyclerView) {
              int layoutId = R.layout.item_list_main;
              View view = LayoutInflater.from(parent.getContext()).inflate(layoutId, parent, false);
              view.setFocusable(true);
              return new BaseItemAdapterViewHolder(view);
  
          } else {
              throw new RuntimeException(TAG + &quot;Not bound to recyclerView&quot;);
          }
      }
  
      @Override
      public void onBindViewHolder(@NonNull BaseItemAdapterViewHolder holder, int position) {
          Task task = mTaskList.get(position);
          holder.mItemTextView.setText(&quot;- &quot; + task.getName());
  
          holder.itemView.setTag(task);
          holder.itemView.setOnLongClickListener(mOnLongClickListener);
      }
  
      @Override
      public int getItemCount() {
          return mTaskList.size();
      }
  
      public void loadItems(List&lt;Task&gt; taskList) {
          mTaskList = taskList;
          notifyDataSetChanged();
      }
  
      public class BaseItemAdapterViewHolder extends RecyclerView.ViewHolder {
          @BindView(R.id.item_textView)
          TextView mItemTextView;
  
          public BaseItemAdapterViewHolder(View view) {
              super(view);
              ButterKnife.bind(this, view);
          }
      }
  }
  </code></pre>