代码完成不适用于外部库 XML 属性 (Android Studio) [英] Code completion does not work for External Library XML attributes (Android Studio)
问题描述
我使用的是 Android Studio 1.1 RC 1
.
我已将外部库导入 Gradle:
I've imported an external library into Gradle:
compile 'com.rengwuxian.materialedittext:library:1.8.3'
我添加了命名空间标签:
I've added the namespace tag:
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"/>
我获得了库中自定义视图的代码完成,即:
I get code completion for the custom views within the library i.e.:
<com.rengwuxian.materialedittext.MaterialAutoCompleteTextView />
但是当我尝试为此视图的属性进行代码完成时,什么也没有出现.我必须手动输入所有这些.
But nothing comes up when I try code completion for the attributes for this view. I have to type all this in manually.
<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"/>
是否有我遗漏的设置或导入?
Is there a setting or import that I'm missing?
有用信息:可以在此处找到库中的属性文件.https://github.com/rengwuxian/MaterialEditText/blob/master/library/src/main/res/values/attrs.xml
Helpful Info: The attribute file in the library can be found here. https://github.com/rengwuxian/MaterialEditText/blob/master/library/src/main/res/values/attrs.xml
推荐答案
我遇到了同样的问题.但是我已经解决了.转到文件 > 使缓存无效/重新启动... > 单击无效并重新启动这是一种有效的方式.你可以试试.
I had the same issue. But I have solved it. Go File > Invalidate Caches / Restart... > Click at Invalidate and Restart It's an efficient way. You can try.
来源:Android Studio - 自动完成和其他功能不工作
注意:这里还有一些其他方法.看看.
Note: Here are some other approaches too. Have a look.
这篇关于代码完成不适用于外部库 XML 属性 (Android Studio)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!