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;
    }
});

你可能感兴趣的:(android)