title: Onclick doesn't get triggered on CardView
body: <p>I have an <code>OnClickListener</code> on a <code>CardView</code>. The listener only works when I tap on a region outside the content(TextViews/ImageViews). I also have a linear layout inside my <code>CardView</code>. I wanted it to work when I tap anywhere on the <code>CardView</code>. Is there a better way to implement this compared to how I'm doing it?</p>
  <p>Here's my <code>CardView</code> in xml</p>
  <pre><code>&lt;android.support.v7.widget.CardView
      xmlns:card_view=&quot;http://schemas.android.com/apk/res-auto&quot;
      android:id=&quot;@+id/card_view&quot;
      android:layout_gravity=&quot;center&quot;
      android:padding=&quot;10dp&quot;
      android:layout_margin=&quot;3dp&quot;
      android:elevation=&quot;3dp&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;&gt;
  
      &lt;LinearLayout
          android:layout_width=&quot;match_parent&quot;
          android:orientation=&quot;vertical&quot;
          android:layout_height=&quot;wrap_content&quot;&gt;
          &lt;TextView
              android:id=&quot;@+id/post_type&quot;
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:background=&quot;@drawable/guilt_theme&quot;
              android:padding=&quot;4dp&quot;
              android:text=&quot;GUILT&quot;
              android:textColor=&quot;@color/textColor&quot;
              android:textSize=&quot;12sp&quot;
              android:textStyle=&quot;bold&quot; /&gt;
  
          &lt;TextView
              android:id=&quot;@+id/post_text&quot;
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:textAllCaps=&quot;false&quot;
              android:layout_marginTop=&quot;10dp&quot;
              android:focusableInTouchMode=&quot;false&quot;
              android:clickable=&quot;true&quot;
              android:text=&quot;text content&quot;
              android:textColor=&quot;@color/secondaryText&quot;
              android:textSize=&quot;16sp&quot; /&gt;
  
          &lt;TextView
              android:id=&quot;@+id/date_user&quot;
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:layout_marginTop=&quot;3dp&quot;
              android:inputType=&quot;number&quot;
              android:text=&quot;on 16/5/2018 by user&quot;
              android:textColor=&quot;@color/weaker_text&quot;
              android:textSize=&quot;14sp&quot; /&gt;
  
          &lt;LinearLayout
              android:id=&quot;@+id/LinearLayout&quot;
              android:layout_width=&quot;match_parent&quot;
              android:orientation=&quot;horizontal&quot;
              android:layout_height=&quot;wrap_content&quot;&gt;
  
              &lt;ImageView
                  android:id=&quot;@+id/view_image&quot;
                  android:layout_width=&quot;20dp&quot;
                  android:layout_height=&quot;20dp&quot;
                  android:clickable=&quot;true&quot;
                  android:focusable=&quot;true&quot;
                  android:background=&quot;?attr/selectableItemBackground&quot;
                  android:layout_marginTop=&quot;4dp&quot;
                  android:src=&quot;@drawable/ic_action_name&quot; /&gt;
  
              &lt;TextView
                  android:id=&quot;@+id/total_views&quot;
                  android:layout_width=&quot;wrap_content&quot;
                  android:layout_height=&quot;wrap_content&quot;
                  android:text=&quot;2&quot;
                  android:inputType=&quot;number&quot;
                  android:layout_marginTop=&quot;3dp&quot;
                  android:textColor=&quot;@color/secondaryText&quot;
                  android:textSize=&quot;14sp&quot;
                  android:textStyle=&quot;bold&quot; /&gt;
              &lt;ImageView
                  android:layout_marginLeft=&quot;20dp&quot;
                  android:id=&quot;@+id/like_image&quot;
                  android:layout_width=&quot;20dp&quot;
                  android:layout_marginTop=&quot;4dp&quot;
                  android:clickable=&quot;true&quot;
                  android:focusable=&quot;true&quot;
                  android:background=&quot;?attr/selectableItemBackground&quot;
                  android:src=&quot;@drawable/thumbs_up&quot;
                  android:layout_height=&quot;20dp&quot; /&gt;
  
              &lt;TextView
                  android:id=&quot;@+id/total_upvotes&quot;
                  android:layout_width=&quot;wrap_content&quot;
                  android:layout_height=&quot;wrap_content&quot;
                  android:text=&quot;2&quot;
                  android:layout_marginTop=&quot;3dp&quot;
                  android:inputType=&quot;number&quot;
                  android:textColor=&quot;@color/secondaryText&quot;
                  android:textSize=&quot;14sp&quot;
                  android:textStyle=&quot;bold&quot; /&gt;
  
              &lt;ImageView
                  android:id=&quot;@+id/dislike_image&quot;
                  android:layout_marginLeft=&quot;20dp&quot;
                  android:layout_width=&quot;20dp&quot;
                  android:layout_marginTop=&quot;4dp&quot;
                  android:src=&quot;@drawable/thumb_down&quot;
                  android:clickable=&quot;true&quot;
                  android:focusable=&quot;true&quot;
                  android:background=&quot;?attr/selectableItemBackground&quot;
                  android:layout_height=&quot;20dp&quot; /&gt;
  
              &lt;TextView
                  android:id=&quot;@+id/total_downvotes&quot;
                  android:layout_width=&quot;wrap_content&quot;
                  android:layout_height=&quot;wrap_content&quot;
                  android:text=&quot;2&quot;
                  android:layout_marginTop=&quot;3dp&quot;
                  android:inputType=&quot;number&quot;
                  android:textColor=&quot;@color/secondaryText&quot;
                  android:textSize=&quot;14sp&quot;
                  android:textStyle=&quot;bold&quot; /&gt;
  
  
  
          &lt;/LinearLayout&gt;
      &lt;/LinearLayout&gt;
   &lt;/android.support.v7.widget.CardView&gt;
  </code></pre>
  <p>I then added a listener to it in my Activity.</p>
  <pre><code> viewHolder.cardView.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                 Intent intent = new Intent(getActivity(), PostReader.class);
                 TextView posttext = view.findViewById(R.id.post_text);
                 String post = posttext.getText().toString();
                  intent.putExtra(&quot;postinfo&quot;, post);
                  startActivity(intent);
              }
          });
  </code></pre>