H 我已经编写了一个代码来在 MapField 上绘制两个自定义位置标记。但是当我放大和缩小时,位置标记的大小相同,我希望位置标记根据缩放级别进行调整。有人可以帮我戴上这个吗?
BR,苏皮
编辑:
到目前为止,我能够做到这一点,
mPointDest = new XYRect[mPoints.length];
for (int i = 0; i < mPoints.length; i++) {
XYPoint fieldOut = new XYPoint();
convertWorldToField(mPoints[i], fieldOut);
mIcon = Bitmap.getBitmapResource("location.png");
int imgW = mIcon.getWidth();
int imgH = mIcon.getHeight();
mPointDest[i] = new XYRect(fieldOut.x - imgW / 2,
fieldOut.y - imgH, imgW, imgH);
graphics.drawBitmap(mPointDest[i], mIcon, 0, 0);
和缩放:
protected boolean keyChar(char character, int status, int time)
{
// 'i' will zoom in.
if (character == 'i')
{
mMapField.setZoom(Math.max(mMapField.getZoom() - 1, mMapField.getMinZoom()));
return true;
}
// 'o' will zoom out
if (character == 'o')
{
mMapField.setZoom(Math.min(mMapField.getZoom() + 1, mMapField.getMaxZoom()));
return true;
}
return super.keyChar(character, status, time);
}
在此之后我想知道如何根据缩放级别调整位图。有人可以给我一些想法吗?