本文介绍了可以创建地图V2透明的信息窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hieveryone一question.I应用这样的信息窗口的背景:

Hieveryone, one question.I apply the background of infowindows like this:

的android:背景=#5500

但似乎有一个白色的背景总是落后的,是有可能摆脱呢?
谢谢!

but there seems to be a white background always behind it, is it possible to get rid of that?Thank you!

推荐答案

实现您自己InfoWindowAdapter定制设计的信息窗口

Implement your own InfoWindowAdapter for custom designing infoWindow

举例code

    private final View mWindow;

    public MarkerAdapter() {
        mWindow = getLayoutInflater().inflate(R.layout.custom_info_window,
                null);
    }

    @Override
    public View getInfoContents(Marker mark) {

        return null;
    }

    @Override
    public View getInfoWindow(Marker marker) {

        render(marker, mWindow);
        return mWindow;
    }

    private void render(Marker marker, View view) {
        int badge;
        // Use the equals() method on a Marker to check for equals. Do not
        // use ==.
        badge = R.drawable.ic_launcher;

        ((ImageView) view.findViewById(R.id.badge)).setImageResource(badge);

        String title = marker.getTitle();
        TextView titleUi = ((TextView) view.findViewById(R.id.title));

        titleUi.setText(title);

        String snippet = marker.getSnippet();
        TextView snippetUi = ((TextView) view.findViewById(R.id.snippet));

        snippetUi.setText(snippet);

    }

}

然后调用它作为

mMap.setInfoWindowAdapter(new MarkerAdapter());

这篇关于可以创建地图V2透明的信息窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-23 01:47