一款Android XML布局问题,谷歌地图 [英] A android xml layout problem with google map
本文介绍了一款Android XML布局问题,谷歌地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想建立一个像这样的布局:
I want to build a layout like this:
我的XML code:
My XML code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:id="@+id/base">
<com.google.android.maps.MapView
android:id = "@+id/mapView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="0HD__0DaIgzDb8nHjJsuggkHlW1MofMwg-xVCpA"
/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</EditText>
<LinearLayout android:id="@+id/linearLayout1"
android:gravity="bottom"
android:layout_width="fill_parent"
android:orientation="horizontal"
android:layout_height="wrap_content"
android:layout_weight="1">
<Button android:text="Cancel"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_weight="1" ></Button>
<Button android:text="Confirm"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_weight="1" ></Button>
</LinearLayout>
</LinearLayout>`
但结果出来的总谷歌地图放在的每一件事情上面。结果
我该如何解决这个问题?
But the result come out the total google map is put on top of every thing.
How can I fix this?
推荐答案
使用相对布局
我已修改了code。使用如下因素code
Use Relative Layout I have modified your code. Use the folowing code
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:id="@+id/base">
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:id="@+id/editText"
>
</EditText>
<LinearLayout
android:id="@+id/linearLayout1"
android:gravity="bottom"
android:layout_width="fill_parent"
android:orientation="horizontal"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_alignParentBottom="true">
<Button
android:text="Cancel"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_weight="1"></Button>
<Button
android:text="Confirm"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_weight="1"></Button>
</LinearLayout>
<com.google.android.maps.MapView
android:id="@+id/mapView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="0HD__0DaIgzDb8nHjJsuggkHlW1MofMwg-xVCpA"
android:layout_below="@+id/editText"
android:layout_above="@+id/linearLayout1"/>
</RelativeLayout>
这篇关于一款Android XML布局问题,谷歌地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文