I have implemented the recycler view in navigation drawer in android.This is working fine.I am able to switch between item by clicking on recycler view item. but i am not able to change the background color for the selected item.please suggest me how to imeplement it.I have tried this so far.

我在android中的导航抽屉中实现了回收器视图。这样工作正常。我可以通过单击回收器视图项来切换项目。但是我无法改变所选项目的背景颜色。请告诉我如何改进它。到目前为止我已经尝试过了。

1.Background Selector in RecyclerView Item Tried to make recycler view clickable,focusable but didn't work

1. RecyclerView项目中的背景选择器试图使回收者视图可点击,可聚焦但不起作用

2.http://innodroid.com/blog/post/tracking-selected-item-in-recyclerview

implemented but didn't understand where to write the code for changing background

实现但不明白在哪里编写代码来改变背景

Please help me out.

请帮帮我。

2 个解决方案

#1


Recycler view are recommend when you have very large items & wants to have a custom UI. If you want to display only few items the would recommend to use List View.

如果您有非常大的商品并希望拥有自定义UI,则建议使用Recycler视图。如果您只想显示几个项目,建议使用列表视图。

更多相关文章

  1. 在职状态,下家说要等我提辞职并做了人事背景调查后才发Offer. 这
  2. springMVC使用html视图配置详解
  3. 自定义视图无法工作,直到我触摸屏幕
  4. 做一个没有视图的零食吧?

随机推荐

  1. Python表白?别傻了,女神是拿来撩的!
  2. 用Node.js创建安全的 GraphQL API[每日前
  3. 奥斯卡,究竟谁一直在陪跑。
  4. 如何正确使用Node.js事件[每日前端夜话0x
  5. JavaScript 中的强制类型转换[每日前端夜
  6. 大江大河,一代人的缩影。
  7. 用Python生成抖音字符视频!
  8. 用Python将HTML转为PDF。
  9. 怎样与 CORS 和 cookie 打交道[每日前端
  10. 我怎样用Node.js自动完成工作的[每日前端