Как добавить progressBar и текстовое представление в нижней части MapsActivity - PullRequest
0 голосов
/ 13 января 2019

Я хотел бы добавить индикатор выполнения и текстовое представление внизу моей карты.

Я пытался перетащить на вкладку "Дизайн" в activity_maps.xml, но виджет не был добавлен. Я также попытался добавить их с помощью вкладки «Текст», но они остаются в верхнем левом углу моей активности.

<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.giacomo.miopgo2.MapsActivity" >

/>

<TextView
    android:id="@+id/txtIndirizzo"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentEnd="@+id/txtIndirizzo"
    android:padding="5dp"
    android:text="Il Mio Indirizzo"

    android:visibility="visible" />

<ProgressBar
    android:id="@+id/pgbVitaGiocaotre"
    style="?android:attr/progressBarStyleHorizontal"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_marginBottom="8dp"
    android:layout_marginEnd="8dp"
    android:layout_marginStart="8dp"
    android:layout_marginTop="8dp"
    android:layout="@+id/linearLayout" />

<TextView
    android:id="@+id/txtElisir"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:padding="5dp"
    android:text="NElisir"

    android:visibility="visible" />

Понятия не имею, как решить. Спасибо за ваше время и внимание.

1 Ответ

0 голосов
/ 13 января 2019

Это потому, что ваш корневой макет не настроен должным образом, попробуйте следующее:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:map="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

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


    <TextView
        android:id="@+id/txtIndirizzo"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:padding="5dp"
        android:text="Il Mio Indirizzo"
        android:visibility="visible" />

    <ProgressBar
        android:id="@+id/pgbVitaGiocaotre"
        style="?android:attr/progressBarStyleHorizontal"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_toEndOf="@+id/txtIndirizzo"
        android:layout_marginStart="8dp"
        android:layout_marginTop="8dp"
        android:layout_marginEnd="8dp"
        android:layout_marginBottom="8dp"
        android:layout="@+id/linearLayout" />

    <TextView
        android:id="@+id/txtElisir"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_toEndOf="@+id/pgbVitaGiocaotre"
        android:padding="5dp"
        android:text="NElisir"
        android:visibility="visible" />
</RelativeLayout>
...