Home » Android » Eclipse Android plugin not listing attributes with auto-complete for custom component

Eclipse Android plugin not listing attributes with auto-complete for custom component

Posted by: admin May 14, 2020 Leave a comment


In general, the Eclipse Android plug in is working as expected with auto-complete. However, it is not working for a custom control that I wrote. Basically, the auto complete list is empty other than the default namespace options.

The control inherits from the Button widget and adds some additional text. I have a couple of extra attributes that I use defined as such:

<?xml version="1.0" encoding="utf-8"?>
    <declare-styleable name="SubTextButton"
        <attr name="sub_text" format="string" />
        <attr name="sub_text_size" format="float" />
        <attr name="sub_text_color" format="color" />

otherwise it uses all the standard attributes of the Button widget.

In the layout file I specify the namespace:

<?xml version="1.0" encoding="utf-8"?>

and I use the control:


Everything works fine, but users don’t have the benefit of the auto-complete to see what attributes are available. Ideally, I’d like to see the inherited Button attributes as well as the custom attributes I’ve defined.

Any ideas?

How to&Answers:

It does not work for me, either, on Eclipse helios with ADT v0.9.7

However, it could be possible (thanks to the resources xml file and the introspection of the parent class).
I had a (longer than expected) look in the ADT source code (I love open-source), and I think it should work. The method computeAttributeProposals(...) from AndroidContentAssist reads attributes in an ElementDescriptor and it seems they should be correctly initialized for custom controls thanks to CustomViewDescriptorService


I found that closing all the Properties views and reopening caused my custom attributes to be shown