【问题标题】:Code completion does not work for External Library XML attributes (Android Studio)代码完成不适用于外部库 XML 属性 (Android Studio)
【发布时间】:2015-03-08 00:50:41
【问题描述】:

我正在使用Android Studio 1.1 RC 1

我已将一个外部库导入 Gradle:

compile 'com.rengwuxian.materialedittext:library:1.8.3'

我已经添加了命名空间标签:

xmlns:app="http://schemas.android.com/apk/res-auto"

进入父级如下:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/primary_light"
    android:orientation="vertical"
    android:padding="20dp"
    tools:context="net.xxx.xxx.ui.activities.Activity"/>

我获得了库中自定义视图的代码完成,即:

<com.rengwuxian.materialedittext.MaterialAutoCompleteTextView />

但是当我尝试对此视图的属性进行代码完成时,什么也没有出现。我必须手动输入所有这些。

<com.rengwuxian.materialedittext.MaterialAutoCompleteTextView
    android:id="@+id/autocomplete"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:completionThreshold="3"
    android:hint="Enter name"
    android:imeOptions="actionDone"
    app:floatingLabel="normal"
    app:floatingLabelText="Find xxx"/>

是否有我缺少的设置或导入?

有用信息: 库中的属性文件可以在这里找到。 https://github.com/rengwuxian/MaterialEditText/blob/master/library/src/main/res/values/attrs.xml

【问题讨论】:

    标签: android android-studio android-library


    【解决方案1】:

    我有同样的问题。但我已经解决了。 Go File > Invalidate Caches / Restart... > 点击 Invalidate and Restart 这是一种有效的方式。你可以试试。

    来源:Android Studio - Auto complete and other features not working

    注意:这里还有一些其他方法。看看吧。

    【讨论】:

    • 这是一个比重新安装 Android Studio 更容易的解决方案。谢谢大家!
    猜你喜欢
    • 2013-09-11
    • 2015-08-21
    • 2022-01-02
    • 1970-01-01
    • 2014-04-11
    • 2014-09-14
    • 2019-12-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多