Mapgis问题集锦

1. mapview annotation setCalloutView()无法控制弹出气泡的大小.

解决办法: 给inflate进来的view的子view设置高宽,则会有就能控制气泡的大小.

AnnotationView annotationView = new AnnotationView(annotation, context);
View contentView = LayoutInflater.from(context).inflate(R.layout.content_annotation_jingq, null);

DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
int width = displayMetrics.widthPixels / 2;
View ll = contentView.findViewById(R.id.ll_xxx);
LinearLayout.LayoutParams p = (LinearLayout.LayoutParams) ll.getLayoutParams();
p.width = width;
ll.setLayoutParams(p);

2. scrollView嵌套mapview滑动事件冲突. 

解决办法: 重写mapview的Ontouch事件.

mapview.getChildAt(0).setOnTouchListener(new View.OnTouchListener() {
    @Override
    public boolean onTouch(View v, MotionEvent event) {
        if(event.getAction() == MotionEvent.ACTION_UP){
            scrollView.requestDisallowInterceptTouchEvent(false);
        }else{
            scrollView.requestDisallowInterceptTouchEvent(true);
        }
        return false;
    }
});

猜你喜欢

转载自blog.csdn.net/u012049463/article/details/61624824
今日推荐