Add check to a view on Android

83 views Asked by At

Hello friends a question like I can add the following view to a view inside a gridview. I am working on the selection of photos but I would like to be able to create a view Like the following, but I have no idea how to add the check in the photo Does anyone know how I can start on that?

Thank you

enter image description here

2

There are 2 answers

1
Ajay Shrestha On

You already did great. Just follow this steps.

  1. Initially, Hide the checkbox
  2. Detect when user click the Grid cell, and make check visible
  3. If user click again, Hide the Check
0
Oren Zakay On

you can set a foreground drawable.

xml :

android:foreground="@drawable/check_bg"

java code :

mImageView.setForeground(ContextCompat.getDrawable(context, R.drawable.check_bg));