I'm introducing multiple custom widgets for my application, extending View. These widgets (LineGraph and DotMatrix) include various attributes that can be set via the layout-xml. How can I have multiple widgets using attributes with the same name. For instance, 2 attributes both having color as an attribute that can be set via the layout XML?
main.xml snippet:
Using xml Syntax Highlighting
- xmlns:app="http://schemas.android.com/apk/res/net.vlemmix.android.widgetdemos"
- <net.vlemmix.android.widget.DotMatrix
- android:id="@+id/dotmatrix1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- app:color="0xFFF" />
Parsed in 0.001 seconds, using GeSHi 1.0.8.4
attrs.xml snippet:
Using xml Syntax Highlighting
- <?xml version="1.0" encoding="UTF-8"?>
- <resources>
- <declare-styleable
- name="DotMatrix">
- <attr
- name="color"
- format="integer" />
- </declare-styleable>
- </resources>
Parsed in 0.001 seconds, using GeSHi 1.0.8.4
When I want to add the info for my LineGraph in attrs.xml, Eclipse starts to whine: "ERROR Attribute "color" has already been defined"
Using xml Syntax Highlighting
- <?xml version="1.0" encoding="UTF-8"?>
- <resources>
- <declare-styleable
- name="DotMatrix">
- <attr
- name="color"
- format="integer" />
- </declare-styleable>
- <declare-styleable
- name="LineGraph">
- <attr
- name="color"
- format="integer" />
- </declare-styleable>
- </resources>
Parsed in 0.002 seconds, using GeSHi 1.0.8.4
Is it not possible to have a DotMatix resource with a color attribute, and a LineGraph resource with a color attribute?

