当前位置:网站首页>1.2Recyclerview实现Item点击事件
1.2Recyclerview实现Item点击事件
2022-07-30 01:01:00 【兰琛】
ps:我所写的是fragment,和在activity中的实现是一样的。
Recyclerview实现item的点击监听五步走:
第一步:定义接口
第二步:在viewholder中实现单击监听
第三步:在onCreateView中传入接口实例化的类
第四步:暴露接口,使得activity能够联系上
第五步:在activity实现Adapter的地方实现具体的点击事件
在adapter中的代码:
在fragment中的代码:
边栏推荐
- [Flutter] Flutter preloading of mixed development solves the problem of slow page loading for the first time
- Google Chrome (google) is set to translate Chinese, the translation option does not take effect or the translation option does not pop up
- 7.27
- SSM整合案例
- How Filebeat ensures that the log file is still correctly read when the log file is split (or rolled)
- CMake Tutorial Tour (1)_Basic starting point
- Recurrent Neural Network (RNN)
- i.MX6U-driver development-3-new character driver
- 重建二叉树
- Missing X64 mfc140u. DLL file - > application cannot normal boot (0 xc000007b) solution
猜你喜欢

@RequestParam注解的详细介绍

字符串替换空格

百度智能云章淼:详解企业级七层负载均衡开源软件BFE

经典毕业设计:基于SSM实现高校后勤报修系统

Baidu Intelligent Cloud Zhangmiao: Detailed explanation of enterprise-level seven-layer load balancing open source software BFE

Fabric 私有数据案例

遇到bug的解决办法,测试再也不背锅了

Recommendation systems: feature engineering, common features

exness: U.S. GDP shrinks, yen bounces back

How to increase account weight?3 ways to operate your own media to help you get more revenue
随机推荐
CMake Tutorial Tour (1)_Basic starting point
【mysql】Mysql公用表表达式with as
STM32——OLED显示实验
Nacos micro service ~ Nacos 】 【 configuration of the center
裁员趋势下的大厂面试:“字节跳动”
小白必看|不用编程的labview,ATECLOUD完全满足你的需求
How to realize the frame selection of objects in canvas (6)
nacos集群配置详解
TCP/IP 常见问题
what is a .pro file in qt
The range of motion of the robot
string replace spaces
How Navicat Connects to MySQL
验证框架-01
CMake Tutorial 巡礼(1)_基础的起点
"The lighthouse factory" of China path: smart roll out from point to surface
FlutterBoost 3.0出现 Activity无法转换为ExclusiveAppComponent<Activity>的解决办法
测试员容易陷入的9大误区
try_catch捕获异常
Minimum number to rotate array