所以我有一个自定义覆盖,它扩展了itemizedoverlay,以便在地图上放置一个标记。我的问题是我想调整标记,以便drawable的边界与boundCenterBottm和boundCenter值不同(在我的情况下,我想要像boundLeftBottom一样存在)。我该如何实现这一目标?我想要达到这个目的的原因是因为我有一个指向左下角的drawable。
我在网上搜索过,非常感谢任何帮助。
建议不要向左侧制作均匀透明的空间。我认为这是一个不正确的解决方法
编辑;
我最终得到了这个:
public class CustomOverlay extends ItemizedOverlay<CustomOverlayItem> {
private ArrayList<CustomOverlayItem> mOverlays = new ArrayList<CustomOverlayItem>();
private Context mContext;
public CustomOverlay(Drawable defaultMarker, Context context) {
// super(boundCenterBottom(defaultMarker));
super(defaultMarker);
defaultMarker.setBounds(0, -defaultMarker.getIntrinsicHeight(), defaultMarker.getIntrinsicWidth(), 0); //TODO experiment
mContext = context;
}
这是正确的,虽然它没有解决我的问题,因为grafic不是在角落里完美而且有3个不同的drawables会很难修复(所以最终解决方案是我要修复drawable )。
答案 0 :(得分:3)
boundCenterBottom和boundCenter是在drawable上调用setBounds的辅助函数...你可以自己调用它。
对于左下角,我认为它看起来像这样:
drawable.setBounds(0, -drawable.getIntrinsicHeight(), drawable.getIntrinsicWidth(), 0);
但那只是我的头脑。