当前位置:网站首页>1.2Recyclerview实现Item点击事件
1.2Recyclerview实现Item点击事件
2022-07-30 01:01:00 【兰琛】
ps:我所写的是fragment,和在activity中的实现是一样的。
Recyclerview实现item的点击监听五步走:
第一步:定义接口
第二步:在viewholder中实现单击监听
第三步:在onCreateView中传入接口实例化的类
第四步:暴露接口,使得activity能够联系上
第五步:在activity实现Adapter的地方实现具体的点击事件
在adapter中的代码:
在fragment中的代码:
边栏推荐
- He cell separation technology 丨 basic primary cell separation methods and materials
- LABVIEW详细介绍:LABVIEW是什么软件?都可以干什么?
- try_catch捕获异常
- The range of motion of the robot
- [MySQL series] MySQL database foundation
- SSM整合案例
- Graph Theory: Bipartite Graphs
- Worthington Optimized Technology: Cell Quantification
- 测试员容易陷入的9大误区
- Linux - install MySQL (detailed tutorial)
猜你喜欢

STM32 - OLED display experiment

Meetings OA To Be Meeting && All Meetings

Print linked list from end to beginning

【MySQL系列】MySQL数据库基础

Chinese semantic matching

exness:美国GDP萎缩,日元反弹受捧

Fabric Private Data Case

泰克Tektronix示波器软件TDS2012|TDS2014|TDS2022上位机软件NS-Scope

WeChat developer tools set the tab size to 2

CMake Tutorial Tour (1)_Basic starting point
随机推荐
9 common mistakes testers fall into
Navicat报错:1045-Access denied for user [email protected](using passwordYES)
重新定义分析 - EventBridge 实时事件分析平台发布
自学HarmonyOS应用开发(47)- 自定义switch组件
自学HarmonyOS应用开发(49)- 引入地图功能
Google Chrome (google) is set to translate Chinese, the translation option does not take effect or the translation option does not pop up
Recommendation system: collection of user "behavioral data" [use Kafka and Cassandra to process data] [if it overlaps with business data, it also needs to be collected independently]
Win11的WSL2系统更换磁盘和wsl使用简介
Based on TNEWS 'today's headline news in Chinese short text classification
He used to cells harvested trypsin & release procedure
软考 --- 数据库(5)数据库控制
【LeetCode每日一题】——637.二叉树的层平均值
二维数组的查找
Ubuntu中使用SQLite
Self-study HarmonyOS application development (56) - Use Service to ensure that the application runs continuously in the background
Graph Theory: Bipartite Graphs
Worthington Enzymatic Cell Harvest & Cell Adhesion and Harvest
【Flutter】Flutter inspector 工具使用详解,查看Flutter布局,widget树,调试界面等
Fabric Private Data Case
Running a Fabric Application