title: Android: Changing visibility of a view in recyclerView
body: <p>I have implemented a <code>recyclerView</code> in my project.</p>
  
  <p>I have a <code>Button</code> in my <code>recyclerView</code> <code>row</code>. The code for my each row of <code>recyclerView</code> is like this:</p>
  
  <p><strong>savedmessage_custom_row.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:layout_margin="4dp"
  android:background="#ffffff"
  android:orientation="vertical"&gt;
  &lt;TextView
      android:id="@+id/message"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_margin="16dp"
      android:text="Dummy text" /&gt;
  &lt;Button
      android:id="@+id/button"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:text="Button"
      android:visibility="gone"/&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>The visibility of button is <code>gone</code>. I want to change the visibility of this button to 'visible' when someone clicks on the <code>message</code> <code>textView</code> above it. I implemented a simple <code>onClickLiestener()</code> on the <code>message (textView)</code> and changed the visibility of <code>button</code>on click of the <code>message</code>. I knew that wasn't going to work but I wanted to see the results. The results are weird. If I click on the textView of row 1, the button of row 7,17,19 etc <strong>also</strong> becomes visible. I can guess this might be coz of caching of the viewHolder.</p>
  
  <p>MyViewHolder is something like this: </p>
  
  <pre><code>class MyViewHolder extends RecyclerView.ViewHolder {
      TextView message;
      public MyViewHolder(final View itemView) {
          super(itemView);
          message = (TextView) itemView.findViewById(R.id.message);
          message.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  itemView.findViewById(R.id.button).setVisibility(View.VISIBLE);
              }
          });
      }
  }
  </code></pre>
  
  <p>Can someone guide me how can I change the visibility of a button, <strong>of a perticular row only</strong>, of my recyclerView?</p>