简体   繁体   中英

Add check to a view on Android

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

在此处输入图片说明

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

you can set a foreground drawable.

xml :

android:foreground="@drawable/check_bg"

java code :

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM