• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Kotlin recyclerview row item selection background color change

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am able to change the color of the text and background of row clicked of my recyclerview in my recyclerview.
But my problem is after clicking for example on the 2th item,the 10st item also gets selected.Likewise after clicking my 5th item the 3nd item is selected.

How do i solve this?
in fact my question is that how to change background color of recyclerview item that click on it in Kotlin?
AllChanelAdapter.kt

AllChanelHolder.kt

MainPageActivity.kt

AllChanelModel.kt

activity_main_page.xml

allchanel_singleitem.xml


please help me
thank you
 
Rancher
Posts: 664
10
Android Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

masood cmpy wrote:But my problem is after clicking for example on the 2th item,the 10st item also gets selected.Likewise after clicking my 5th item the 3nd item is selected.


How you know the 10th item gets selected when you click on 2th item ? Are they changing the background color to yellow too ?
Check the position value, are the position value printed is same as the position you clicked?
 
masood cmpy
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Randy Tong wrote:

masood cmpy wrote:But my problem is after clicking for example on the 2th item,the 10st item also gets selected.Likewise after clicking my 5th item the 3nd item is selected.


How you know the 10th item gets selected when you click on 2th item ? Are they changing the background color to yellow too ?
Check the position value, are the position value printed is same as the position you clicked?



because whene i clicke on 2th item, background of 2th item is changed But background of another item(for example 10th) is changed too!!!
yes they are changing the background color to yellow too !!!
Check the position value, are the position value printed is same as the position you clicked? ========> Yes same are
 
reply
    Bookmark Topic Watch Topic
  • New Topic