title: RecyclerView - CardViews overlap each other when scrolling (How to add multiple rows to a single CardView?)
body: <p>The entire layout is set like this - A RecyclerView that contains several card views, and each cardview can have multiple rows of LinearLayouts of exact type (but with different data).</p>
  
  <p>Everything works okay, except when I scroll down or up, the Cards begins to overlap over other cards randomly. </p>
  
  <p>Here's the code: </p>
  
  <pre><code>public class MyAdapter extends RecyclerView.Adapter&lt;MyAdapter.ViewHolder&gt; implements View.OnClickListener{
  
      Context context;
  
      public MyAdapter(Context context)
      {
          this.context = context;
      }
  
      @Override
      public int getItemCount() {
          return 20;
      }
  
      @Override
      public void onBindViewHolder(ViewHolder holder, int position) {
  
          try {
  
              LinearLayout.LayoutParams contentParams = new LinearLayout.LayoutParams(100, 100);
  
              LayoutInflater inflater = LayoutInflater.from(context);
  
              LinearLayout ll_parent = (LinearLayout) inflater.inflate(R.layout.parent_linearlayout, null, false);
              NetworkImageView networkImageView = new NetworkImageView(context);
              String URL = "https://www.google.co.in/images/branding/product/ico/googleg_lodp.png";
              networkImageView.setImageUrl(URL, VolleySingleton.getInstance(context).getImageLoader());
              networkImageView.setLayoutParams(contentParams);
              networkImageView.setPadding(20, 20, 20, 20);
  
              TextView tv_card_title = new TextView(context);
              tv_card_title.setPadding(20, 20, 20, 20);
  
              LinearLayout ll_title = new LinearLayout(context);
  
              ll_title.setOrientation(LinearLayout.HORIZONTAL);
  
              ll_title.addView(networkImageView);
              ll_title.addView(tv_card_title);
              ll_title.setPadding(20, 20, 20, 20);
  
              ll_parent.addView(ll_title);
  
              for (int j = 0; j &lt; getItemCount(); j++)
              {
                  LinearLayout ll_children = (LinearLayout) inflater.inflate(R.layout.child_views, null, false);
  
                  Button bt_delete = (Button) ll_children.findViewById(R.id.bt_delete);
                  bt_delete.setTag("card no: " + (position+1) + " Iteration: "  + (j+1));
                  bt_delete.setOnClickListener(this);
                  Button bt_edit = (Button) ll_children.findViewById(R.id.bt_edit);
                  bt_edit.setTag("card no: " + (position + 1) + " Iteration: " + (j + 1));
                  bt_edit.setOnClickListener(this);
  
                  TextView tv_abc = (TextView)ll_children.findViewById(R.id.tv_abc);
                  tv_abc.setText("ABC");
                  tv_abc.setTypeface(null, Typeface.BOLD);
  
                  tv_card_title.setText("ABC");
                  tv_card_title.setTypeface(null, Typeface.BOLD);
  
                  NetworkImageView iv_Image = (NetworkImageView)ll_children.findViewById(R.id.iv_Image);
  
                  iv_profileImage.setImageUrl(URL, VolleySingleton.getInstance(context).getImageLoader());
                  ll_parent.addView(ll_children);
              }
              holder.cardView.addView(ll_parent);
  
          } catch (JSONException e) {
              e.printStackTrace();
          }
  
      }
  
      @Override
      public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
          View itemView = LayoutInflater.
                  from(viewGroup.getContext()).
                  inflate(R.layout.grandparent_cardview, viewGroup, false);
  
          return new ViewHolder(itemView);
      }
  
      @Override
      public void onClick(View v) {
          switch (v.getId())
          {
              case R.id.bt_delete:
  
                  break;
  
              case R.id.bt_edit:
  
                  break;
          }
      }
  
      public static class ViewHolder extends RecyclerView.ViewHolder {
  
          CardView cardView;
  
          public ViewHolder(View v)
          {
              super(v);
              cardView = (CardView) v.findViewById(R.id.cv);
          }
      }
  }
  </code></pre>
  
  <p><strong>What's wrong with the code above? Is there a better way to add multiple rows (of same type) to a single CardView?</strong></p>