gpt4 book ai didi

android - 如何使 Android 交互式 InfoWindow over Google Maps API2 透明

转载 作者:行者123 更新时间:2023-11-29 20:54:08 25 4
gpt4 key购买 nike

我实现了 perfect answerchose007使 InfoWindow over Google Maps API2 在我的应用程序中可点击。唯一的问题是,我想让 InfoWindow 透明(使其呈气泡状)。我可以使用样式包装器使用非交互式 InfoWindow 来做到这一点:

gMap.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() {

@Override
public View getInfoWindow(Marker marker) {

ContextThemeWrapper cw = new ContextThemeWrapper(
getApplicationContext(),R.style.TransparentDialog);
LayoutInflater inflater = (LayoutInflater) cw
.getSystemService(LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.map_bubble,
null);
return layout;
}

InfoWindow 显示为透明,但无法在以下位置设置窗口内容:

 @Override
public View getInfoContents(Marker marker) {
// Setting up the infoWindow with current's marker info
TextView bubHd = (TextView) infoWindow.findViewById(R.id.bubble_hd);
bubHd.setText(places.get(placeId).getTitle());
.
.
.

它并没有更具交互性,因为交互性也在 getInfoContents 中设置,在我看来,如果 getInfoWindow 返回非 null 结果。

有谁知道如何使 Google map 上的交互式 InfoWindow 透明?

最佳答案

The InfoWindow appears as transparent, but it is not possible to set the contents of the window in getInfoContents()

正确。如果 getInfoWindow() 返回一个非 null 值,您应该返回带有 completecomplete 信息窗口> 内容,并且 getInfoContents() 将不会被调用。将您的 getInfoContents() 方法主体语句移动到 getInfoWindow() 中。

关于android - 如何使 Android 交互式 InfoWindow over Google Maps API2 透明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28257007/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com