title: Android RecyclerView is not saving its state when scrolling back
body: <p>I have a recyclerview in which onLongClick() of an item, I am showing a button. But <code>when scroll down the recycler view and scrolling back, that button is showing on top of another item or sometimes it is not showing</code> at all.
  Here is my code</p>
  
  <pre><code>public static class TextViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener,View.OnLongClickListener{
      public LinearLayout enq_layout;
      public LinearLayout item_layout;
      public TextView enquire;
      public int position;
  
      public TextViewHolder(View itemView) {
          super(itemView);
          item_layout= (LinearLayout) itemView.findViewById(R.id.item_layout);
          enq_layout= (LinearLayout) itemView.findViewById(R.id.enq_layout);
          enquire=(TextView) itemView.findViewById(R.id.enquire);
          //position=getLayoutPosition();
      }
  }
  
  @Override
  public int getItemViewType(int position) {
      return product.get(position)!=null? VIEW_ITEM: VIEW_PROG;
  }
  
  @Override
  public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
  
          View v = LayoutInflater.from(parent.getContext())
                  .inflate(R.layout.cardlayout_product, parent, false);
          RecyclerView.ViewHolder vh = new TextViewHolder(v);
      return vh;
  }
  @Override
  public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
     // Toast.makeText(act, "onBindViewHolder" +position, Toast.LENGTH_LONG).show();
          final ProductDetails item = product.get(position);
          final TextViewHolder hold=((TextViewHolder)holder);
  
          //hold.position=position;
        //  hold.item_layout.setTag(position);
  
          hold.item_layout.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
               // go to next activity
              }
          });
          hold.item_layout.setOnLongClickListener(new View.OnLongClickListener() {
              @Override
              public boolean onLongClick(View view) {
                 // show enquiry button
                  hold.enq_layout.setVisibility(View.VISIBLE);
              }
          });
          hold.enquire.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                 //do some operation
                  int productid = Integer.parseInt(product.get(item.getPosition()).getProduct_id());
              }
          });
  }
  @Override
  public int getItemCount() {
      return product.size();
  }
  </code></pre>
  
  <p>I tried this way <a href="https://stackoverflow.com/questions/24885223/why-doesnt-recyclerview-have-onitemclicklistener-and-how-recyclerview-is-dif?lq=1">Why doesn&#39;t RecyclerView have onItemClickListener()? And how RecyclerView is different from Listview?</a>, but I am not able to access the views inside onCreateViewHolder's onclick methods.</p>