【发布时间】:2017-04-14 01:47:09
【问题描述】:
我使用自定义的信息窗口,以便获得灰色背景和白色文本颜色。然而,我在它周围有一个白框。我希望所有信息窗口都是灰色的,包括指向该点的三角形边缘。
我在我的Activity 中使用此代码:
map.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() {
@Override // Use default InfoWindow frame
public View getInfoWindow(Marker marker) { return null; }
@Override // Defines the contents of the InfoWindow
public View getInfoContents(Marker marker) {
View v = getLayoutInflater().inflate(R.layout.map_info_window, null);
TextView tv_location = (TextView) v.findViewById(R.id.tv_location);
tv_location.setText(marker.getTitle());
return v;
}});
这是我的布局:
<!--?xml version="1.0" encoding="utf-8"?-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map_info_window"
android:layout_width="match_parent"
android:background="@color/light_grey"
android:orientation="horizontal"
android:layout_height="match_parent" >
<TextView
android:id="@+id/tv_location"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white" />
</LinearLayout>
【问题讨论】:
标签: android android-layout google-maps-api-3