当前位置:网站首页>The solution to the left-right sliding conflict caused by nesting Baidu MapView in the fragment of viewpager
The solution to the left-right sliding conflict caused by nesting Baidu MapView in the fragment of viewpager
2022-07-06 17:29:00 【geekqian】
Reference material : http://jp1017.top/2016/07/28/ViewPager-%E5%B5%8C%E5%A5%97%E7%99%BE%E5%BA%A6%E5%9C%B0%E5%9B%BE%E4%BA%8B%E4%BB%B6%E5%86%B2%E7%AA%81%E7%9A%84%E8%A7%A3%E5%86%B3%E6%96%B9%E6%B3%95/
That's the problem , I am here ViewPager One of them Fragment Baidu is nested in MapView after , There is a left-right sliding conflict , It's disabled ViewPager The slide of …
I found a wave of information on the Internet , The easiest and most efficient way to find one is to customize it ViewPager , So the code is as follows .
public class MyViewPager extends ViewPager {
public MyViewPager(@NonNull Context context) {
super(context);
}
public MyViewPager(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}
@Override
protected boolean canScroll(View v, boolean checkV, int dx, int x, int y) {
return v.getClass().getName().equals("com.baidu.mapapi.map.MapView")
|| v.getClass().getName().equals("com.amap.api.maps.MapView")
|| super.canScroll(v, checkV, dx, x, y);
}
}
Then right-click this customized ViewPager choice “Copy Reference” Copy relative paths , Replace the original “androidx.viewpager.widget.ViewPager”.
The running result perfectly solves this problem .
边栏推荐
- mysql高級(索引,視圖,存儲過程,函數,修改密碼)
- About selenium starting Chrome browser flash back
- JVM类加载子系统
- 应用服务配置器(定时,数据库备份,文件备份,异地备份)
- À propos de l'utilisation intelligente du flux et de la carte
- Akamai浅谈风控原理与解决方案
- Final review of information and network security (based on the key points given by the teacher)
- DataGridView scroll bar positioning in C WinForm
- Junit单元测试
- Use of mongodb in node
猜你喜欢
[reverse intermediate] eager to try
华为认证云计算HICA
MySQL string function
03 products and promotion developed by individuals - plan service configurator v3.0
07个人研发的产品及推广-人力资源信息管理系统
Data transfer instruction
Interpretation of Flink source code (III): Interpretation of executiongraph source code
Flink 解析(三):内存管理
C version selenium operation chrome full screen mode display (F11)
Application service configurator (regular, database backup, file backup, remote backup)
随机推荐
8086 segmentation technology
[mmdetection] solves the installation problem
Case: check the empty field [annotation + reflection + custom exception]
vscode
02 personal developed products and promotion - SMS platform
【逆向】脱壳后修复IAT并关闭ASLR
PostgreSQL 14.2, 13.6, 12.10, 11.15 and 10.20 releases
MySQL string function
灵活报表v1.0(简单版)
On the clever use of stream and map
Redis installation on centos7
虚拟机启动提示Probing EDD (edd=off to disable)错误
Redis快速入门
mysql的列的数据类型详解
mysql高级(索引,视图,存储过程,函数,修改密码)
02个人研发的产品及推广-短信平台
EasyRE WriteUp
学习投资大师的智慧
À propos de l'utilisation intelligente du flux et de la carte
Redis quick start