0
我想在安卓地图v2中开发一个自定义信息窗口。我想知道如何从信息窗口中删除白色背景,以及如何将圆圈半径之外的背景设置为透明黑安卓地图v2中的自定义信息窗口
这是我的自定义信息窗口中的XML
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/dp"
android:orientation="vertical">
</LinearLayout>
这是我的代码来创建一个自定义信息窗口
getMap().getMap().setInfoWindowAdapter(new InfoWindowAdapter() {
@Override
public View getInfoWindow(Marker arg0) {
// TODO Auto-generated method stub
return null;
}
@Override
public View getInfoContents(Marker arg0) {
// TODO Auto-generated method stub
// Getting view from the layout file info_window_layout
View v = getLayoutInflater().inflate(R.layout.windowlayout,
null);
return v;
}
});
private SupportMapFragment getMap() {
return ((SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map));
}
这是我的标志点击
@Override
public void onMapClick(LatLng point) {
// TODO Auto-generated method stub
Toast.makeText(getApplicationContext(), point.toString(),
Toast.LENGTH_SHORT).show();
getMap().getMap().animateCamera(CameraUpdateFactory.newLatLng(point));
CameraUpdate zoom = CameraUpdateFactory.zoomTo(8);
getMap().getMap().moveCamera(CameraUpdateFactory.newLatLng(point));
getMap().getMap().animateCamera(zoom);
Marker marker;
getMap().getMap().clear();
marker = getMap().getMap().addMarker(
new MarkerOptions()
.draggable(true)
.position(point)
.title("Pick Up")
.icon(BitmapDescriptorFactory
.fromResource(R.drawable.marker)));
// marker.setPosition(point);
marker.showInfoWindow();
rl.setVisibility(View.VISIBLE);
}
这是我的地图布局
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/data"
android:layout_alignParentTop="true" >
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.muratonnet.map.TouchableSupportMapFragment" />
<RelativeLayout
android:id="@+id/rl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/circle"
android:layout_gravity="center"
android:visibility="gone" >
</RelativeLayout>
</FrameLayout>
<LinearLayout
android:id="@+id/data"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<include layout="@layout/data_table" />
</LinearLayout>
</RelativeLayout>
的[更改谷歌地图API V2标记的信息窗口视图的边缘颜色]可能重复(http://stackoverflow.com/questions/ 18282718/change-the-margin-color-of-infowindow -in-marker-in-google-maps-api-v2) – 2014-10-07 06:51:50
感谢Manish你的回答确实奏效,它移除了空白区域 – Ranjith 2014-10-07 06:57:18
你知道如何实现围绕圆圈的黑色背景 – Ranjith 2014-10-07 06:58:02