我正在做一个可访问性项目,需要使用API Map。我在Android Studio中看不到地图。出现以下错误:
Unknown Fragments - The <fragment> tag allows the layout file to dynamically include different layouts at runtime. At layout editing time the specific layout to be used is not known. You can choose which layout you would like previewed while editing the layout.
- <fragment com.google.android.gms.maps.SupportMapFragment ...> (Pick Layout ...)
Do not warn about <fragment> tags in this session.
有谁有解决方案吗?
感谢您的收听
发布于 2020-07-13 17:34:42
这里的问题是Android studio IDE不知道在布局编辑器中插入哪个片段,因为片段是在运行时插入的。
要解决此问题,请遵循以下步骤(以下步骤适用于Sceneform片段示例,但相同的原则也适用于其他片段)
添加的行将如下所示:
<fragment
android:id="@+id/ux_fragment"
android:name="com.google.ar.sceneform.ux.ArFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout="@layout/sceneform_ux_fragment_layout" /> //This the new line inserted
发布于 2018-11-08 09:21:58
<?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=".MapsActivity" />
https://stackoverflow.com/questions/53177851
复制相似问题