如何在Google Maps V2 Android中的标记上指定图标的大小 [英] How to specify the size of the icon on the Marker in Google Maps V2 Android
本文介绍了如何在Google Maps V2 Android中的标记上指定图标的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在可能的应用程序中,我使用来自Google Maps V2的地图,并且在此地图中,我试图为每个标记添加一个标记与一个图标,但标记正在使图标的大小变为使图标看起来像烟道。
如何在 dp 中指定标记的大小,以便我可以控制它在地图上的样子
In may app i use Map from Google Maps V2 and in this map i am trying to add markers each Marker with an icon, but the marker is taking the size of the icon which is making the icon looks flue. How can i specify the size of the marker in dp so that i can control how it looks like on the map
推荐答案
目前我认为我们不能改变标记大小,所以你可以在drawable中添加标记图像,然后重新调整大小:
Currently i think we cannot change the marker size, so u can add marker image in drawable and re-size something like this:,
int height = 100;
int width = 100;
BitmapDrawable bitmapdraw=(BitmapDrawable)getResources().getDrawable(R.mipmap.marker);
Bitmap b=bitmapdraw.getBitmap();
Bitmap smallMarker = Bitmap.createScaledBitmap(b, width, height, false);
Ur添加标记就像图标
Ur add marker be like this with icon
map.addMarker(new MarkerOptions()
.position(POSITION)
.title("Your title")
.icon(BitmapDescriptorFactory.fromBitmap(smallMarker))
);
这篇关于如何在Google Maps V2 Android中的标记上指定图标的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文