Android 如何在MapsActivity底部添加progressBar和textView
我想在MapsActivity的底部添加一个progressBar和一个textView 我试图拖入Android 如何在MapsActivity底部添加progressBar和textView,android,textview,progress-bar,google-maps-api-2,Android,Textview,Progress Bar,Google Maps Api 2,我想在MapsActivity的底部添加一个progressBar和一个textView 我试图拖入activity\u maps.xml中的设计选项卡,但没有添加任何小部件。我还尝试使用文本选项卡添加它们,但它们仍然位于活动的左上角 <fragment xmlns:android="http://schemas.android.com/apk/res/android" xmlns:map="http://schemas.android.com/apk/res-auto" xmlns:to
activity\u 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" />
/>
没有关于如何解决的线索。感谢您的时间和考虑。这是因为您的根布局设置不正确,请尝试以下操作:
<?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>
您能提供活动地图.xml
的代码吗?@MayurGajra当然可以。给你。我想我发现了错误,请看我的答案。应该解决了,非常感谢@MayurGajra