TextView does not appear at the top of the Google map.

TextView is not displaying on the top of the screen

Here is my code

 <?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>      
+4
source share
5 answers

add android:layout_below="@+id/distance"as Fragmentxml attribute as below ...

<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" />
+3
source

add layout_below

   <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" />
0
source

<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" />

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

, textview , .

, textview .

<RadioGroup>

android:layout_alignParentBottom="true"

with below one

android:layout_below="@+id/distance"

& <fragment> wrap_content match_parent

0

android:layout_below="@id/distance"

id android: id = "@+ id/map"

0

Source: https://habr.com/ru/post/1530169/


All Articles