title: Change the border of a CircleImageView in a RecyclerView
body: <p>I have a horizontal RecyclerView that shows images for selection of a "profile" image.</p>
  
  <p><a href="https://i.stack.imgur.com/Cy7Ml.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Cy7Ml.png" alt="enter image description here"></a></p>
  
  <p>I'm using CircleImageView to leave the images with rounded corners, this library makes it possible to place a border on each image.</p>
  
  <p><strong>Note a RecyclerViewItemLayout.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"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:orientation="vertical"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"&gt;
  
     &lt;de.hdodenhof.circleimageview.CircleImageView
         android:id="@+id/avatar_select"
         android:paddingTop="5dp"
         android:layout_width="80dp"
         android:layout_height="80dp"
         android:padding="5dp"
         app:civ_border_color="@color/colorPrimary"
         app:civ_border_width="3dp"
         android:src="@drawable/avatar1"/&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>When an item is clicked, the CircleImageView border should match the color of the ColorAsset, and when a new item is clicked (as if the user changed his or her opinion about the "profile" photo and wanted another), the new item should receive the border and the old selection should return to ColorPrimary. </p>
  
  <p><strong>Note a RecyclerViewAdapter.java</strong></p>
  
  <pre><code>public class AvatarAdapter extends RecyclerView.Adapter&lt;AvatarAdapter.MyViewHolder&gt; {
  
  private Context mContext;
  private List&lt;Avatar&gt; mdata;
  
  
  public AvatarAdapter(Context mContext, List&lt;Avatar&gt; mdata) {
      this.mContext = mContext;
      this.mdata = mdata;
  }
  
  
  @NonNull
  @Override
  public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
  
      View view;
      LayoutInflater mInflater = LayoutInflater.from(mContext);
      view = mInflater.inflate(R.layout.escolhe_avatar,parent,false);
      final MyViewHolder vHolder = new MyViewHolder(view);
  
      return vHolder;
  }
  
  @Override
  public void onBindViewHolder(@NonNull final MyViewHolder holder, int position) {
  
      holder.image.setImageResource(mdata.get(position).getImage());
  
      holder.image.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              holder.image.setOnClickListener(new View.OnClickListener() {
                  @Override
                  public void onClick(View v) {
                      holder.image.setBorderColor(R.color.colorAccent);
                  }
              });
          }
      });
  
  }
  
  @Override
  public int getItemCount() {
      return mdata.size();
  }
  
  public static class MyViewHolder extends RecyclerView.ViewHolder {
  
      private CircleImageView image;
      public MyViewHolder(View itemView){
          super(itemView);
  
          image = (CircleImageView) itemView.findViewById(R.id.avatar_select);
  
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p><a href="https://i.stack.imgur.com/Igfw1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Igfw1.png" alt="enter image description here"></a></p>
  
  <p>I already broke my head, I researched but I could not reach a solution, can anyone help me please?</p>