佈局運用了絕對佈局的方式,如下
<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<com.google.android.maps.MapView
android:id="@+id/mv"
android:clickable="true"
android:enabled="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:apiKey="0RAabqk4Sv25aZe8mzF_UN1tS4WrydOuIZBy7fA" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/navigation"
android:text="導航"
android:layout_x="20dip"
android:layout_y="20dip"/>
</AbsoluteLayout>
在地圖上添加了一個導航按鈕,效果如下:
通過該方法,通過調整佈局和運用圖片等方法,可以定義出更美觀的佈局