简体   繁体   English

AndroidStudio 找不到布局

[英]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.

相关问题 找不到符号 textView AndroidStudio - cannot find symbol textView AndroidStudio AndroidStudio无法解析R和布局文件 - AndroidStudio cannot resolve R and layout files 无法将 TextInputEditText 放置在 TextInput 布局的顶部。 安卓工作室 - Cannot place TextInputEditText on Top of TextInput Layout. AndroidStudio AndroidStudio / gradle找不到javax.persistence包 - AndroidStudio / gradle cannot find javax.persistence package 相对布局的AndroidStudio问题 - AndroidStudio Problem with Relative Layout 在AndroidStudio中查找SharedPreference的用法 - Find usages of SharedPreference in AndroidStudio 充气机找不到布局-Android - Inflater cannot find layout - Android cordova构建android失败:找不到模块&#39;C:[…] \\ platforms \\ android \\ cordova \\ lib \\ AndroidStudio&#39; - cordova build android fails: Cannot find module 'C:[…]\platforms\android\cordova\lib\AndroidStudio' 错误:在androidStudio中尝试制作toyVpn示例项目时找不到符号方法setHttpProxy(ProxyInfo)问题 - error: cannot find symbol method setHttpProxy(ProxyInfo) problem when try to make toyVpn sample project in androidStudio AndroidStudio:无法解析符号MainActivity - AndroidStudio : Cannot resolve symbol MainActivity
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM