kotlin GoogleMap活动不会在设计器中显示

ebdffaop  于 2022-12-13  发布在  Kotlin
关注(0)|答案(1)|浏览(139)

代码运行时没有错误,但设计器给我错误并且不会出现

Cycle found (count=51) evaluating 'activity_nearby_places' with pathString="file:///c:/ path="C:\New folder (148)\GaspriceinEgypt\app\src\main\res\layout\activity_nearby_places.xml" stratIndex=3 suffixEndIndex=3 separator='\\"(parserfile=file:\\\\ C:\New folder (148)\GaspriceinEgypt\app\src\main\res\layout\activity_nearby_places.xml)

<?xml version="1.0" encoding="utf-8"?>
<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=".NearbyPlaces"
  tools:layout="@layout/activity_nearby_places" />
kgsdhlau

kgsdhlau1#

您似乎创建了一个重复循环。
tools:layout不应该引用您所在的文件,而是您希望设计器显示的某个示例布局文件。
来自文档:This attribute declares which layout you want the layout preview to draw inside the fragment (because the layout preview cannot execute the activity code that normally applies the layout).
请尝试删除tools:layout=行,或在其中放入更合适的内容。
https://developer.android.com/studio/write/tool-attributes#toolslayout

相关问题