当前位置:网站首页>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 .
边栏推荐
- vscode
- JVM之垃圾回收器下篇
- 微信防撤回是怎么实现的?
- 06 products and promotion developed by individuals - code statistical tools
- connection reset by peer
- Interpretation of Flink source code (III): Interpretation of executiongraph source code
- 关于Stream和Map的巧用
- Brush questions during summer vacation, ouch ouch
- Login to verify the simple use of KOA passport Middleware
- CTF reverse entry question - dice
猜你喜欢
JVM class loading subsystem
JVM garbage collector part 2
[reverse intermediate] eager to try
Idea breakpoint debugging skills, multiple dynamic diagram package teaching package meeting.
网络分层概念及基本知识
Selenium test of automatic answer runs directly in the browser, just like real users.
Re signal writeup
吴军三部曲见识(四) 大家智慧
JVM garbage collector part 1
【逆向】脱壳后修复IAT并关闭ASLR
随机推荐
肖申克的救赎有感
JVM运行时数据区之程序计数器
DataGridView scroll bar positioning in C WinForm
05 personal R & D products and promotion - data synchronization tool
connection reset by peer
List set data removal (list.sublist.clear)
虚拟机启动提示Probing EDD (edd=off to disable)错误
Some feelings of brushing leetcode 300+ questions
vscode
[reverse primary] Unique
程序员定位解决问题方法论
Only learning C can live up to expectations top2 P1 variable
Akamai 反混淆篇
EasyRE WriteUp
C# WinForm系列-Button简单使用
自动答题 之 Selenium测试直接运行在浏览器中,就像真正的用户在操作一样。
Only learning C can live up to expectations top3 demo exercise
MySQL basic addition, deletion, modification and query of SQL statements
C version selenium operation chrome full screen mode display (F11)
【MMdetection】一文解决安装问题