android recyclerview 设置的adapter 怎么设置点击事件
1个回答
展开全部
homeBtnAdapter.setOnRVItemClickListener(new BGAOnRVItemClickListener() { //item点击事件
@Override
public void onRVItemClick(ViewGroup viewGroup, View view, int i) {
if(null != homeBtnAdapter && homeBtnAdapter.getItemCount() > 0 && null != activity &&!activity.isFinishing()){
HomeBtn entity = homeBtnAdapter.getItem(i); //获取点击的项
if(null != entity && null != entity.getCls()) {
//点击事件的实现
}
}
}
});
homeBtnAdapter是我的recyclerview 适配器,继承BGARecyclerViewAdapter
@Override
public void onRVItemClick(ViewGroup viewGroup, View view, int i) {
if(null != homeBtnAdapter && homeBtnAdapter.getItemCount() > 0 && null != activity &&!activity.isFinishing()){
HomeBtn entity = homeBtnAdapter.getItem(i); //获取点击的项
if(null != entity && null != entity.getCls()) {
//点击事件的实现
}
}
}
});
homeBtnAdapter是我的recyclerview 适配器,继承BGARecyclerViewAdapter
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询