Eclipse Android插件未列出自定义组件的自动完成属性

jsm*_*ith 11 android eclipse-plugin

一般来说,Eclipse Android插件正在按预期工作,具有自动完成功能.但是,它不适用于我编写的自定义控件.基本上,除默认命名空间选项外,自动完成列表为空.

控件继承自Button小部件并添加一些其他文本.我有一些额外的属性,我使用这些属性定义如下:

<?xml version="1.0" encoding="utf-8"?>
<resources> 
    <declare-styleable name="SubTextButton"
        <attr name="sub_text" format="string" />
        <attr name="sub_text_size" format="float" />
        <attr name="sub_text_color" format="color" />
    </declare-styleable>
</resources>
Run Code Online (Sandbox Code Playgroud)

否则它使用Button小部件的所有标准属性.

在布局文件中,我指定了命名空间:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res/com.mycompany"
    ...
Run Code Online (Sandbox Code Playgroud)

我使用控件:

<com.mycompany.SubTextButton
    android:layout_width="@dimen/status_bar_button_w"
    android:layout_height="@dimen/status_bar_button_h"
    android:layout_alignParentRight="true"
    android:background="@drawable/button_bg"
    android:text="HCD"
    android:textColor="@color/static_text"
    android:textSize="@dimen/font_size_standard"
    app:sub_text="SET"
    app:sub_text_size="12.0"
/>
Run Code Online (Sandbox Code Playgroud)

一切正常,但用户没有自动完成的好处,看看有哪些属性可用.理想情况下,我希望看到继承的Button属性以及我定义的自定义属性.

有任何想法吗?

rds*_*rds 1

它对我来说也不起作用,在带有 ADT v0.9.7 的 Eclipse helios 上

不过,这是可能的(感谢resourcesxml 文件和父类的内省)。我(比预期更长)查看了 ADT 源代码(我喜欢开源),我认为它应该可以工作。该方法computeAttributeProposals(...)读取AndroidContentAssistan 中的属性ElementDescriptor,并且似乎应该为自定义控件正确初始化它们,这要归功于CustomViewDescriptorService