当前位置:网站首页>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 .
边栏推荐
- 学习投资大师的智慧
- Take you hand-in-hand to do intensive learning experiments -- knock the level in detail
- 信息与网络安全期末复习(完整版)
- 基于LNMP部署flask项目
- Logical operation instruction
- Precipitated database operation class - version C (SQL Server)
- Display picture of DataGridView cell in C WinForm
- Akamai浅谈风控原理与解决方案
- 06 products and promotion developed by individuals - code statistical tools
- arithmetic operation
猜你喜欢
随机推荐
Flink 解析(七):时间窗口
关于Selenium启动Chrome浏览器闪退问题
Brush questions during summer vacation, ouch ouch
Wu Jun's trilogy experience (VII) the essence of Commerce
Wu Jun's trilogy insight (V) refusing fake workers
自动答题 之 Selenium测试直接运行在浏览器中,就像真正的用户在操作一样。
吴军三部曲见识(七) 商业的本质
集成开发管理平台
CentOS7上Redis安装
06 products and promotion developed by individuals - code statistical tools
TCP's three handshakes and four waves
Data transfer instruction
程序员定位解决问题方法论
02个人研发的产品及推广-短信平台
List集合数据移除(List.subList.clear)
03个人研发的产品及推广-计划服务配置器V3.0
Compile homework after class
Assembly language addressing mode
JVM garbage collection overview
JVM garbage collector part 2