title: How to highlight a selection in a view in Android with Java
body: <p>So what I am trying to achieve is the following.</p>
  <p>If a user click on one of the two images in a Framelayout, the image get highlighted (denotes that it was selected).</p>
  <pre><code>&lt;FrameLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;
      android:id=&quot;@+id/rootView&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;
      android:orientation=&quot;vertical&quot;&gt;
  
      &lt;androidx.cardview.widget.CardView
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;wrap_content&quot; &gt;
  
  
          &lt;ImageView
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;180dp&quot;
              android:layout_centerHorizontal=&quot;true&quot;
              app:srcCompat=&quot;@drawable/field_background&quot; /&gt;
  
          &lt;ImageView
              android:layout_width=&quot;160dp&quot;
              android:layout_height=&quot;150dp&quot;
              android:layout_gravity=&quot;top|left&quot;
              app:srcCompat=&quot;@drawable/forty&quot; /&gt;
  
          &lt;ImageView
              android:layout_width=&quot;160dp&quot;
              android:layout_height=&quot;150dp&quot;
              android:layout_gravity=&quot;top|right&quot;
              app:srcCompat=&quot;@drawable/hundred&quot; /&gt;
  
      &lt;/androidx.cardview.widget.CardView&gt;
  
  &lt;/FrameLayout&gt;
  </code></pre>
  <p>Would I need to add an other ImageView under the two <code>ImageView</code>s (<code>@drawable/forty</code> and <code>@drawable/hundred</code>) and then in the associated <code>Activity</code> reference those images and highlight them? or is it all done in the <code>Activity</code> view where I can add the highlight image directly there?</p>
  <p>Im new to Android so I am having issues understanding the best path forward.</p>
  <h2>UPDATE:</h2>
  <p>Included the desired effect.
  <a href="https://i.stack.imgur.com/mi5xZ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mi5xZ.jpg" alt="enter image description here" /></a></p>