[英]AndroidStudio Cannot Find Layout
Running AndroidStudio 3.6.2.运行 AndroidStudio 3.6.2。 A number of times I try to create a new fragment/activity, create a layout xml file, but when I try to use the layout AS shows an 'Unresolved reference' error.
很多次我尝试创建一个新的片段/活动,创建一个布局 xml 文件,但是当我尝试使用布局时显示一个“未解决的引用”错误。 One option to 'fix' the problem is for AS to create the layout file for me.
“解决”问题的一种选择是让 AS 为我创建布局文件。 When I select this option the file is created, but AS still says it cannot resolve the reference to the file it just created.
当我 select 这个选项创建文件时,但 AS 仍然说它无法解析对它刚刚创建的文件的引用。 NOTE: It will find other layout files just fine, so it doesn't seem to be how I'm importing the resources.
注意:它会很好地找到其他布局文件,所以它似乎不是我导入资源的方式。
Is this a known issue?这是一个已知的问题?
Here is the content of the layout file I created, just in case someone finds it helpful.这是我创建的布局文件的内容,以防万一有人发现它有帮助。
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<include
layout="@layout/content_video"
android:layout_width="4dp"
android:layout_height="2dp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
android:layout_margin="16dp"
android:orientation="horizontal">
<ImageButton
android:id="@+id/switchVideoCamera"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="center"
android:layout_margin="8dp"
android:background="@android:color/transparent"
app:srcCompat="@drawable/ic_switch_camera_white_24dp" />
<ImageButton
android:id="@+id/display_video"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="center"
android:layout_margin="8dp"
android:background="@android:color/transparent"
app:srcCompat="@drawable/ic_videocam_white_24dp" />
<ImageButton
android:id="@+id/mute_audio"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="center"
android:layout_margin="8dp"
android:background="@android:color/transparent"
app:srcCompat="@drawable/ic_mic_white_24dp" />
<ImageButton
android:id="@+id/connectActionFab"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="center"
android:layout_margin="8dp"
android:background="@android:color/transparent"
app:srcCompat="@android:drawable/stat_sys_phone_call" />
</LinearLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
I am facing the same problem.我面临同样的问题。 I just Restart Android studio with invalidate Cache and it's work for me.
我只是用无效缓存重新启动 Android 工作室,它对我有用。
But when I use the stable version for Android studio 3.6
it perfectly works for me.但是当我使用
Android studio 3.6
的稳定版本时,它对我来说非常有用。
Go to File->Invalidate Caches/Restart Go 到文件->使缓存无效/重新启动
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.