[FIXED] Recycler view select position border will appear and not selected border not appear how to make design in android studio like highlight position

Issue

Recycler view select position border will appear and not selected border not appear how to make design in android studio like highlight position please show my image ..
https://i.stack.imgur.com/boxrT.jpg

Solution

Suppose you want to display list of object. e.g. list of this model class data class User(val name:String, val age:Int, var isSelected:Boolean)
You can see that I have added isSelected:Boolean in Model class.
You can pass true for the item which you want to keep selected and false for other items. When you are done with that you need to add if/else case in adapter in your onBindViewHolder

if(isSelected){
// change you UI for that item selected here
}else {
// change you UI for that items not selected here
}

Answered By – Amit Balani

Answer Checked By – Laura B. (Easybugfix Admin)

Leave a Reply

(*) Required, Your email will not be published