當(dāng)前位置:
首頁(yè) >
【错误记录】安卓 RecyclerView 报错 ( only use immediately and call holder.getAdapterPosition() to look it up )
發(fā)布時(shí)間:2025/6/17
31
豆豆
生活随笔
收集整理的這篇文章主要介紹了
【错误记录】安卓 RecyclerView 报错 ( only use immediately and call holder.getAdapterPosition() to look it up )
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
文章目錄
- 一、報(bào)錯(cuò)信息
- 二、解決方案
一、報(bào)錯(cuò)信息
報(bào)錯(cuò)信息 : 在 RecyclerView.Adapter 中的 onBindViewHolder 方法中 , 報(bào)如下錯(cuò)誤 ;
Do not treat position as fixed; only use immediately and call holder.getAdapterPosition() to look it up later二、解決方案
該錯(cuò)誤 , 并不會(huì)影響編譯 , 只是在顯示時(shí)報(bào)錯(cuò) , 不太好看 ;
修改的話 , 可以 禁用 Lint 檢查 , 點(diǎn)擊
" Suppress: Add @SuppressLint("RecyclerView") annotation" 按鈕 ;
會(huì)在該參數(shù)前生成一個(gè)注解 ;
總結(jié)
以上是生活随笔為你收集整理的【错误记录】安卓 RecyclerView 报错 ( only use immediately and call holder.getAdapterPosition() to look it up )的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 【C 语言】字符串拷贝 ( 优化指针操作
- 下一篇: 【C 语言】字符串拷贝 ( 指针使用前判