当前位置:网站首页>1.2Recyclerview实现Item点击事件
1.2Recyclerview实现Item点击事件
2022-07-30 01:01:00 【兰琛】
ps:我所写的是fragment,和在activity中的实现是一样的。
Recyclerview实现item的点击监听五步走:
第一步:定义接口
第二步:在viewholder中实现单击监听
第三步:在onCreateView中传入接口实例化的类
第四步:暴露接口,使得activity能够联系上
第五步:在activity实现Adapter的地方实现具体的点击事件
在adapter中的代码:
在fragment中的代码:
边栏推荐
- Douyin short video traffic acquisition strategy, mastering these will definitely be a hit
- News text classification
- Since the media increase play a short video?From the three aspects
- cp强制覆盖与不覆盖拷贝方法
- 557. 反转字符串中的单词 III
- Finding a 2D Array
- 经典毕业设计:基于SSM实现高校后勤报修系统
- Detailed introduction to the usage of Nacos configuration center
- Meetings OA To Be Meeting && All Meetings
- 【Incubator DAY18】Interesting exchange【Simulation】【Math】
猜你喜欢

转发和重定向的区别及使用场景

Toutiao We-Media Operation: How to Gain 500+ Fans in Toutiao Today?

Navicat如何连接MySQL
[email protected](using passwordYES)"/>Navicat error: 1045-Access denied for user [email protected](using passwordYES)

机器人的运动范围

泰克Tektronix示波器软件TDS210|TDS220|TDS224上位机软件NS-Scope

LABVIEW详细介绍:LABVIEW是什么软件?都可以干什么?

裁员趋势下的大厂面试:“字节跳动”

自学HarmonyOS应用开发(53)- 获取当前位置

从尾到头打印链表
随机推荐
从尾到头打印链表
重新定义分析 - EventBridge 实时事件分析平台发布
Google Chrome (google) is set to translate Chinese, the translation option does not take effect or the translation option does not pop up
How Navicat Connects to MySQL
Unity笔记——FairyGUI
Fabric 私有数据案例
【微服务~Nacos】Nacos之配置中心
557. 反转字符串中的单词 III
News text classification
这是一道非常有争议的题,我的分析如下: TCP/IP在多个层引入了安全机制,其中TLS协议位于______。 A.数据链路层 B.网络层 C.传输层 D.应用层
机器人的运动范围
QTableWidget usage example
Meetings OA To Be Meeting && All Meetings
Baidu Intelligent Cloud Zhangmiao: Detailed explanation of enterprise-level seven-layer load balancing open source software BFE
Recurrent Neural Network (RNN)
Selenium上传文件有多少种方式?不信你有我全
KDE Frameworks 5.20.0: Plasma welcomes many improvements
[Best training DAY16] KC's Can [Dynamic programming]
How to realize the frame selection of objects in canvas (6)
Huawei's "genius boy" Zhihui Jun has made a new work, creating a "customized" smart keyboard from scratch