当前位置:网站首页>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 .
边栏推荐
猜你喜欢
随机推荐
JVM garbage collector part 1
Detailed explanation of data types of MySQL columns
1. JVM入门介绍
[VNCTF 2022]ezmath wp
轻量级计划服务工具研发与实践
Set up the flutter environment pit collection
吴军三部曲见识(七) 商业的本质
Akamai anti confusion
Redis快速入门
【逆向】脱壳后修复IAT并关闭ASLR
[reverse primary] Unique
Flink源码解读(三):ExecutionGraph源码解读
Based on infragistics Document. Excel export table class
Garbage first of JVM garbage collector
Flink parsing (VI): savepoints
EasyRE WriteUp
List集合数据移除(List.subList.clear)
February database ranking: how long can Oracle remain the first?
mysql 基本增删改查SQL语句
Program counter of JVM runtime data area