title: What is the proper way to handling OnClick ButtonView and other View in RecyclerView with touch listener?
body: <p>I have problem on Handling OnClick ButtonView and other View in RecyclerView Staggered Grid with OnTouch.</p>
  
  <p>This my item RecyclerView:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:card_view="http://schemas.android.com/apk/res-auto"
      android:id="@+id/root_parent"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_margin="4dp"
      card_view:cardCornerRadius="10dp"
      card_view:cardUseCompatPadding="true"&gt;
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:orientation="vertical"&gt;
          &lt;com.kamardagang.utils.SelectableRoundedImageView
              android:id="@+id/newsAvatar"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:adjustViewBounds="true"
              android:src="@drawable/ic_user" /&gt;
          &lt;Button
              android:id="@+id/btn_action"
              android:layout_width="match_parent"
              android:layout_height="match_parent"/&gt;
      &lt;/LinearLayout&gt;
  &lt;/android.support.v7.widget.CardView&gt;
  </code></pre>
  
  <p>and this Adapter with Handling Click:</p>
  
  <pre><code>public class NewsAdapter extends RecyclerView.Adapter&lt;NewsAdapter.ViewHolder&gt; implements View.OnTouchListener {
  
      private final GestureDetector gestureDetector;
      private Activity activity;
      public ArrayList&lt;HashMap&lt;String, String&gt;&gt; dataNews;
      private OnNewsItemClickListener OnNewsItemClickListener;
  
      public void setOnNewsItemClickListener(OnNewsItemClickListener onNewsItemClickListener) {
          this.OnNewsItemClickListener = onNewsItemClickListener;
      }
  
      @Override
      public boolean onTouch(View v, MotionEvent event) {
  
          final int viewId = v.getId();
          if (viewId == R.id.root_parent) {
              if (gestureDetector.onTouchEvent(event)) {
                  if (OnNewsItemClickListener != null) {
                      OnNewsItemClickListener.onRootClick(v, (Integer) v.getTag());
                  }
                  return true;
              }
  
          } else if (viewId == R.id.btn_action) {
              if (gestureDetector.onTouchEvent(event)) {
                  if (OnNewsItemClickListener != null) {
                      OnNewsItemClickListener.onActionClick(v, (Integer) v.getTag());
                  }
                  return true;
              }
          }
  
          return false;
      }
  
      public interface OnNewsItemClickListener {
          public void onActionClick(View v, int position);
  
          public void onRootClick(View v, int position);
      }
  
      public NewsAdapter(Activity activity, ArrayList&lt;HashMap&lt;String, String&gt;&gt; News) {
          this.activity = activity;
          dataNews = News;
          gestureDetector = new GestureDetector(activity, new SingleTapConfirm());
      }
  
      public class ViewHolder extends RecyclerView.ViewHolder {
          @Bind(R.id.root_parent)
          CardView root_parent;
          @Bind(R.id.btn_action)
          Button btn_action;
  
          public ViewHolder(View vi) {
              super(vi);
              ButterKnife.bind(this, vi);
  
          }
      }
  
      @Override
      public NewsAdapter.ViewHolder onCreateViewHolder(ViewGroup parent,
                                                       int viewType) {
          View v = LayoutInflater.from(parent.getContext())
                  .inflate(R.layout.pin_item_news_recyclerview, parent, false);
          ViewHolder holder = new ViewHolder(v);
          holder.root_parent.setOnTouchListener(this);
          holder.btn_action.setOnTouchListener(this);
          return holder;
      }
  
      public void onBindViewHolder(final ViewHolder holder, int position) {
          if (position % 2 == 0) {
              holder.root_parent.setVisibility(View.GONE);
              holder.btn_action.setVisibility(View.VISIBLE);
          } else {
              holder.root_parent.setVisibility(View.VISIBLE);
              holder.btn_action.setVisibility(View.GONE);
          }
      }
  
      public int getItemCount() {
          return dataNews.size();
      }
  
      public void delete_all() {
          int count = getItemCount();
          if (count &gt; 0) {
              dataNews.clear();
          }
      }
  
      public long getItemId(int position) {
          return position;
      }
  
      private class SingleTapConfirm extends GestureDetector.SimpleOnGestureListener {
          @Override
          public boolean onSingleTapUp(MotionEvent event) {
              return true;
          }
      }
  }
  </code></pre>
  
  <p>The problem : the Click of R.id.btn_action can detected , but not R.id.root_parent , so how to fix it ?</p>