title: A problem in addView()in ConstraintLayout, don't get the required result
body: <p>The ( else ) part working properly, but the problem is in ( if ) part when adding the view again to the ConstraintLayout.</p>
  <p>I want something like this.</p>
  <p><a href="https://i.stack.imgur.com/xhIEP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xhIEP.png" alt="enter image description here" /></a></p>
  <p>But I get this which is not what I want.</p>
  <p><a href="https://i.stack.imgur.com/OCA7x.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OCA7x.png" alt="enter image description here" /></a></p>
  <pre><code>        public class ChecklistChildViewHolder extends RecyclerView.ViewHolder {
          CheckBox checkBox;
          ImageView delete, edit, move;
          ConstraintLayout constraintLayout;
  
          ChecklistChildViewHolder(@NonNull View itemView) {
              super(itemView);
              checkBox = itemView.findViewById(R.id.checkbox_child);
              delete = itemView.findViewById(R.id.delete_child);
              edit = itemView.findViewById(R.id.edit_child);
              move = itemView.findViewById(R.id.move_child);
              constraintLayout = itemView.findViewById(R.id.constraint_child);
  
          }
  
          public void updateVisibility(boolean isEnableDelete){
  
              ConstraintLayout.LayoutParams lpCheckBox = (ConstraintLayout.LayoutParams) checkBox.getLayoutParams();
              ConstraintLayout.LayoutParams lpDelete = (ConstraintLayout.LayoutParams) delete.getLayoutParams();
              ConstraintLayout.LayoutParams lpEdit = (ConstraintLayout.LayoutParams) edit.getLayoutParams();
  
              if (isEnableDelete) {
  
  
  
                  constraintLayout.removeView(move);
                  constraintLayout.addView(delete);
                  constraintLayout.addView(edit);
                  lpDelete.endToEnd = R.id.constraint_child;
                  lpDelete.startToEnd = R.id.edit_child;
  
                  lpEdit.startToEnd = R.id.checkbox_child;
                  lpEdit.endToStart = R.id.delete_child;
  
                  delete.setLayoutParams(lpDelete);
                  edit.setLayoutParams(lpEdit);
              }
  
              else {
  
                  constraintLayout.removeView(delete);
                  constraintLayout.removeView(edit);
  
                  lpCheckBox.endToStart = R.id.move_child;
                  lpCheckBox.startToStart = R.id.constraint_child;
  
                  checkBox.setLayoutParams(lpCheckBox);
              }
          }
      }
  </code></pre>
  <p>I don't know where the problem is. Any help?</p>