title: scrolling RecyclerView changes other data as well
body: <p>I am using <code>RecyclerView</code> to show the list of items. I have two <code>TextViews</code> one below other. Initially the second <code>TextView</code> is set to <code>singleline = true</code>.Now on item click, I am setting <code>singleline = false</code>. This is just done to expand it on click (Like <code>ExpandableList</code>). The code works fine but the problem is that as <code>RecyclerView</code> uses the recycled item other items TextView values are also being set to <code>singleline = false</code>. Now how can I avoid this?</p>
  
  <p>Code</p>
  
  <pre><code>public class InboxAdapter extends RecyclerView.Adapter&lt;InboxAdapter.InboxViewHolder&gt; {
  
      private Context context;
      private List&lt;InboxModel&gt; listInbox;
      private InboxModel currentItem;
  
      public InboxAdapter(Context context, List&lt;InboxModel&gt; listInbox) {
          this.context = context;
          this.listInbox = listInbox;
      }
  
      @Override
      public InboxViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
          View view = LayoutInflater.from(context).inflate(R.layout.custom_inbox_item, parent, false);
          InboxViewHolder viewHolder = new InboxViewHolder(view);
          return viewHolder;
      }
  
      @Override
      public void onBindViewHolder(final InboxViewHolder holder, int position) {
  
          currentItem = listInbox.get(position);
          holder.tvHeader.setText(currentItem.header);
          holder.tvMsg.setText(currentItem.msg);
  
          holder.tvHeader.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
  
                  holder.tvMsg.setSingleLine(false);
                  LinearLayout.LayoutParams lp= (LinearLayout.LayoutParams) holder.tvMsg.getLayoutParams();
                  lp=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
                  holder.tvMsg.setLayoutParams(lp);
  
              }
          });
  
      }
  
      @Override
      public int getItemCount() {
          return listInbox.size();
      }
  
      class InboxViewHolder extends RecyclerView.ViewHolder {
  
          private TextView tvImageHeader;
          private TextView tvHeader;
          private TextView tvMsg;
          private TextView tvDate;
  
  
          public InboxViewHolder(View itemView) {
              super(itemView);
  
              tvImageHeader = (TextView) itemView.findViewById(R.id.tv_img_header);
              tvHeader = (TextView) itemView.findViewById(R.id.tv_header);
              tvMsg = (TextView) itemView.findViewById(R.id.tv_msg);
              tvDate = (TextView) itemView.findViewById(R.id.tv_date);
          }
      }
  </code></pre>