【发布时间】:2010-08-23 05:07:11
【问题描述】:
我第一次尝试在 Android 中显示地图。
现在I want to display 3 buttons on the map, and when I clicked on a particular button, that button's click event should be raised.地图应该是全屏的,按钮在下方。
我不知道我是怎么做到的?当我们想使用 MapView 显示地图时,我们必须扩展 MapActivity 类。因此,请提出一些想法、示例或参考网站。
已编辑:
我使用以下布局显示地图:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<com.google.android.maps.MapView
android:id="@+id/mapView01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:enabled="true"
android:clickable="true"
android:apiKey="my generated api key"
/>
<Button
android:text="Button"
android:id="@+id/Button01"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</Button>
</LinearLayout>
【问题讨论】:
-
RelativeLayout是您所需要的。虽然...首先让地图单独出现。看来你还没有完成那部分。一旦你的地图工作了,做按钮的东西就很容易了。 -
@Cristian checkout 我已经给出了我用来显示地图的布局编码..现在我必须做什么?感谢您的帮助
标签: android android-layout android-mapview android-button