android - TextView 未显示在 Google map 的顶部

标签 android xml google-maps android-layout

TextView is not displaying on the top of the screen

这是我的代码

 <?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="fill_parent"
        android:layout_height="fill_parent"
        tools:context=".MainActivity" >

        <TextView
            android:id="@+id/distance"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true" />

        <RadioGroup
            android:id="@+id/rg_modes"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:orientation="horizontal" >

            <RadioButton
                android:id="@+id/rb_driving"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:checked="true"
                android:text="@string/str_rb_driving" />

            <RadioButton
                android:id="@+id/rb_walking"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/str_rb_walking" />

            <RadioButton
                android:id="@+id/tv_distance_time"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="distance" />
        </RadioGroup>

        <fragment
            android:id="@+id/map"
            android:name="com.google.android.gms.maps.SupportMapFragment"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_above="@id/rg_modes" />

    </RelativeLayout>      

最佳答案

添加 android:layout_below="@+id/distance" 作为属性 Fragment xml 如下...

<fragment
    android:id="@+id/map"
    android:name="com.google.android.gms.maps.SupportMapFragment"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_above="@id/rg_modes"
    android:layout_below="@+id/distance" />

关于android - TextView 未显示在 Google map 的顶部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22188747/

相关文章:

c# - 从 XML 文件推断出的 XmlSchema - 如何遍历 XSD 中的所有元素?

javascript - 谷歌地图指向正确的位置,但不显示位置名称

javascript - 如何设置 ember-simple-google-maps 环境变量?

javascript - Cordova:暂停事件未触发

xml - 是否有更快的方法来检查 LINQ to XML 中的 XML 元素并解析 bool?

Java XML 属性

ios - 如何定位 Google 地点自动完成功能?

android - 在 android 中注册新的 mime 类型

java - Android 发布/订阅单例示例

android - Eclipse 中 Android 项目的 Javadoc 给出 NullPointerException