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
CodePudding user response:
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
}