I would like to add a progressBar and a textView at the bottom of my MapsActivity.
I tried to drag into the Design tab in activity_maps.xml
but no widget is added. I also tried to add them using Text tab but they remain at the top-left of my activity.
<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" />
No clue about how to solve. Thank you for your time and consideration.
That's because your root layout is not setup properly,Try the following:
<?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>