[英]is there a solution for accessing the first item in a recyclerView
我正在創建用戶指南,我想在用戶指南中描述的項目之一在我的回收站中 請查看幫助我 我正在使用這個庫: com.github.mreram:showcaseview:1.2.0
找到了解決方案:
private var isPlayed = false
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
holder.onFill(holder.adapterPosition)
if (position == 0 && !isPlayed) {
holder.guide()
isPlayed = false
}
}
您可以通過檢查 onBindview 方法中項目的 position 來訪問 recyclerview 的第一項
public void onBindViewHolder(ViewHolder holder, int position) {
if(position==0)
// write your code here
else
// other code
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.