【问题标题】:android map v2 draw something at fixed screen locationandroid map v2 在固定屏幕位置绘制一些东西
【发布时间】:2013-06-26 20:22:42
【问题描述】:

我想在地图上的固定屏幕位置(例如 x=20,y=20),没有地理位置,绘制一些东西(例如多边形)。这类似于我们在地图左下角看到的小“google”。好像map v2不允许……api设计者忘记了。

这里的代码建议: Google Map API V2 - How do I keep a marker in the center of the screen while user is scrolling the map? 会起作用,但用户可能会在移动时看到它...地图 v2 看起来设计得不好。

【问题讨论】:

    标签: android android-maps-v2


    【解决方案1】:

    好像map v2不允许...api设计者忘记了。

    可能不会,只是因为您想要的与地图无关。

    要将小部件层叠在一起,请使用RelativeLayoutFrameLayout。后面的孩子在 Z 轴上会更高,这意味着他们看起来会浮在前面的孩子之上。

    所以,你最终得到了这个布局伪代码:

    <RelativeLayout>
        <MapView> <!-- or perhaps <fragment> -->
        <ImageView>
    </RelativeLayout>
    

    您使用边距和RelativeLayout 规则(如android:alignParentBottom="true")将图像定位在需要的位置。

    【讨论】:

      【解决方案2】:

      在使用 Google Maps Android API v2 时,不要忘记 Android API。只需将 ImageView 添加到您想要显示的图像的布局中。

      【讨论】:

        猜你喜欢
        • 2021-05-08
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-06-26
        • 2022-12-24
        相关资源
        最近更新 更多