I'm relatively new to app development and working with Android Studio and layouts. I'm in the process of designing my app and have encountered an issue. I have the design for a ListItem for a ListView where the player's name and 2 icons (Edit and Delete) should be displayed. So, when the user adds a player, the entries should be displayed like that.
My problem now is: How can I best implement the design in XML to achieve the desired functionality?
ListItem Design, created with Figma
I thought one could design the whole thing as a button in XML, which then receives this design as a background. But then the question is, how can I make the icon clickable?
Or is there any better way to do this, that i might miss here?
First of all - don't use
ListView- it has lots of problems. UseRecyclerView.There are multiple ways to do this. You can use this one, for example:
Don't forget to add path to your image in
ImageViewsrcattribute.Then in your ViewHolder you can find and set
onClickListeneron eachImageView