简体   繁体   中英

How to make checkbox looks like a button in android?

This image is from medium android application. The white boxes are the selected items. How can I make list of items like this and let the user select some of them in android?

Image1

You can import two images and use one or the other depending on if the item is selected or not, for this you need to use a selector.

It´s like this one android button selector ,

Also, I recommend you to use a 9-patch images, you can see more about it here https://developer.android.com/studio/write/draw9patch.html

As the webpage says "They are bitmap images that automatically resize to accommodate the contents of the view and the size of the screen" so I think they would be perfect for your application

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