Osmdroid - 标记 - 增加选择区域以获得信息窗口
Osmdroid - Marker - increase selection area to get the InfoWindow
选择标记时会弹出一个信息窗口。
有时候选择一个Marker是很困难的。特别是当地图在导航方向旋转时。
如何增加 'touch circle' 以便选择更容易?
更新:我必须通过子类化来更改标记的 hitTest()。
我想检查 'hit'(或触摸)是否在标记点周围 X 像素的圆圈内。导航时图标会旋转,所以我想我没有使用该图标。
我该怎么做?
public boolean hitTest(final MotionEvent event, final MapView mapView){
final Projection pj = mapView.getProjection();
pj.toPixels(mPosition, mPositionPixels);
// Does mPositionPixels contains the x, y of the Marker?
// Should I draw a Rect around this point, or could it be a circle?
// How can I check whether the event.getX(), event.getY() is a hit?
return hit;
}
我相信@Mker 会说,扩展标记 class 并覆盖方法 hitTest
。这用于标记本身。我不确定您是否可以为 InfoWindow 本身更改此设置。
间谍提出的方法是可行的。
您还可以创建带有透明像素区域的图标位图。这是增加其触摸面积的一种非常简单的方法。
选择标记时会弹出一个信息窗口。
有时候选择一个Marker是很困难的。特别是当地图在导航方向旋转时。
如何增加 'touch circle' 以便选择更容易?
更新:我必须通过子类化来更改标记的 hitTest()。
我想检查 'hit'(或触摸)是否在标记点周围 X 像素的圆圈内。导航时图标会旋转,所以我想我没有使用该图标。
我该怎么做?
public boolean hitTest(final MotionEvent event, final MapView mapView){
final Projection pj = mapView.getProjection();
pj.toPixels(mPosition, mPositionPixels);
// Does mPositionPixels contains the x, y of the Marker?
// Should I draw a Rect around this point, or could it be a circle?
// How can I check whether the event.getX(), event.getY() is a hit?
return hit;
}
我相信@Mker 会说,扩展标记 class 并覆盖方法 hitTest
。这用于标记本身。我不确定您是否可以为 InfoWindow 本身更改此设置。
间谍提出的方法是可行的。
您还可以创建带有透明像素区域的图标位图。这是增加其触摸面积的一种非常简单的方法。