答案 0 :(得分:2)
使用XML创建视图
<FrameLayout
android:id="@+id/framelayout"
android:layout_height="wrap_content"
android:layout_width="wrap_content">
<ImageView
android:id="@+id/ImageView01"
android:layout_height="wrap_content"
android:layout_width="wrap_content"/>
<TextView android:id="@+id/text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</FrameLayout>
获取视图并设置值
FrameLayout view = (FrameLayout)findViewById(R.id.framelayout);
生成位图
view.setDrawingCacheEnabled(true);
view.buildDrawingCache();
Bitmap bm = view.getDrawingCache();
使用此位图作为标记
Marker myMarker = mMap.addMarker(new MarkerOptions()
.position(0,0)
.icon(BitmapDescriptorFactory.fromBitmap(mybitmap)));