Android Studio - XML 编辑器自动完成功能不适用于支持库 [英] Android Studio - XML Editor autocomplete not working with support libraries

查看:21
本文介绍了Android Studio - XML 编辑器自动完成功能不适用于支持库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始使用新的 android.support.design 库.在 XML 编辑器中使用任何小部件时,我不再收到 XML 自动完成建议!

I just started using the new android.support.design library. When using any of the widgets inside the XML editor I stop getting the XML autocomplete suggestions!

例如

<android.support.design.widget.CoordinatorLayout
    android:id="@+id/header_root"
    android:layout_width="match_parent"
    android:layout_height="200dp">

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/primary_dark" />

    <android.support.design.widget.FloatingActionButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|right"
        android:src="@drawable/ic_action_add"
        android:layout_marginLeft="16dp"
        android:layout_marginRight="16dp"
        android:layout_marginTop="56dp"
        app:fabSize="normal"
        app:layout_anchor="@id/header_root"
        app:layout_anchorGravity="bottom|right|end" />

</android.support.design.widget.CoordinatorLayout>

所有标签都不会显示自动完成弹出窗口,比如当我开始输入android:i"时没有弹出窗口出现,我得到的唯一建议如下图所示.

None of the tags will show the autocomplete popup, like when I start typing "android:i" no popup appears, the only suggestion I get is shown in the following picture.

我尝试清理我的项目,重新启动电脑,重新启动 Android Studio .. 没有任何效果!

I have tried cleaning my project, restarting the pc, restarting Android Studio.. nothing is working!

推荐答案

我尝试了很多东西(重新启动 Android Studio、PC、使缓存无效、节能模式……).

I have tried a lot of things (restart Android Studio, PC, Invalidate Caches, Power Saver mode,...).

最后,从项目中删除 .idea 文件夹和所有 .iml 文件,重新启动 Android Studio 并重新构建 Gradle 即可解决问题.XML 支持库中的自动完成功能再次运行.

Finally, deleting the .idea folder and all .iml files from the project, restarting Android Studio, and rebuilding Gradle did the trick. Autocomplete in XML support library is working again.

从版本控制中检出文件或复制新项目中的所有源文件也可以.

Checking out files from Version Control or copying all the source files in a new project would do the trick as well.

这篇关于Android Studio - XML 编辑器自动完成功能不适用于支持库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆