Android 如何在地图中放置文字并避免重叠?
我想在地图上用按钮locate显示我的位置,但我现在的布局覆盖了地图上的文字,是否有其他方法可以防止这种情况发生,并且可以正确显示地图,而无需获取顶部的以下信息 贴图应在白色边框之后开始。 完整代码布局:Android 如何在地图中放置文字并避免重叠?,android,android-layout,android-fragments,android-relativelayout,Android,Android Layout,Android Fragments,Android Relativelayout,我想在地图上用按钮locate显示我的位置,但我现在的布局覆盖了地图上的文字,是否有其他方法可以防止这种情况发生,并且可以正确显示地图,而无需获取顶部的以下信息 贴图应在白色边框之后开始。 完整代码布局: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="ht
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
tools:context=".MapActivity" >
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:name="com.google.android.gms.maps.MapFragment"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FFFFFF"
android:padding="10dp">
<TextView
android:id="@+id/magTxt"
android:layout_width="60dp"
android:layout_height="wrap_content"
android:textSize="28sp"
android:layout_marginRight="8dp"
android:gravity="center"/>
<TextView
android:id="@+id/richterTxt"
android:layout_width="60dp"
android:layout_height="wrap_content"
android:layout_below="@+id/magTxt"
android:textSize="14sp"
android:layout_marginRight="8dp"
android:text="@string/richterTxt"
android:gravity="center"/>
<TextView
android:id="@+id/tituloLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/magTxt"
android:textSize="16sp"
android:textStyle="bold"
android:text="@string/tituloLabel" />
<TextView
android:id="@+id/tituloTxt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/tituloLabel"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="@+id/profundidadLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/magTxt"
android:textSize="16sp"
android:textStyle="bold"
android:text="@string/profundidadLabel"
android:layout_below="@+id/tituloLabel" />
<TextView
android:id="@+id/depthTxt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/profundidadLabel"
android:textSize="16sp"
android:layout_below="@+id/tituloTxt"
/>
<TextView
android:id="@+id/kmLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/depthTxt"
android:layout_below="@+id/tituloTxt"
android:text="@string/kmLabel"
android:textSize="16sp"
/>
<TextView
android:id="@+id/fechaTxt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/magTxt"
android:textSize="16sp"
android:layout_below="@+id/profundidadLabel"
/>
</RelativeLayout>
</RelativeLayout>
您能提供完整的.xml和按钮吗?@NSimon按钮是map.setMyLocationEnabledtrue的元素部分。我更新了图像。映射应该在白色框架之后开始。然后只需对xml进行重新排序,以便获得RelativeLayout,并在顶部为其指定id,下面的片段带有标记android:layout_Lower=@id/RelativeLayoutIdPerfect,这就行了。谢谢@nsimon很高兴能帮忙!