我在Android Studio工作。它是android版本2.3.2,7.0(nougat)和API 25.对于我的布局/ XML文件,我得到渲染问题,并且还找到了循环链:activity_maps包括activity_maps。
我查看了其他StackOverflow帖子并将API更改为较低版本,通过添加“Base”更改了style.xml文件。要得到 。
这个问题仍然存在,我不知道还能做什么。除了这个之外,我的所有其他布局/ XML设计都有效。这使用地图来获得两点之间的方向。以下是XML文件:
<LinearLayout
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"
tools:context="edu.usf.cse.labrador.familycare.MapsActivity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/etOrigin"
android:hint="Enter your address" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Find path"
android:id="@+id/btnFindPath" />
<ImageView
android:layout_marginLeft="20dp"
android:layout_marginTop="5dp"
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@drawable/ic_distance"/>
<TextView
android:layout_marginLeft="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0 km"
android:id="@+id/tvDistance" />
<ImageView
android:layout_marginLeft="20dp"
android:layout_marginTop="5dp"
android:layout_width="40dp"
android:layout_height="40dp"
android:padding="5dp"
android:src="@drawable/ic_clock"/>
<TextView
android:layout_marginLeft="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0 min"
android:id="@+id/tvDuration" />
</RelativeLayout>
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout="@layout/activity_maps" />
在设计选项中我什么都没看到。布局为空白。
如果您对如何解决此问题有任何建议,请与我们联系。
谢谢!真的很感激。
答案 0 :(得分:1)
这可能不是它,但你错过了结束线性布局。
我把它放进去,它出现在我的屏幕上。
</LinearLayout >
答案 1 :(得分:0)
在片段标签中删除/更改以下内容:
tools:layout="@layout/activity_maps"
如果无法显示其自身的布局