7

I have an attr defined as an enum with a list of values:

<attr name="font" format="enum">
    <enum name="AvenirMedium" value="1" />
    <enum name="AvenirBlack" value="2" />
</attr>

I would like to use multiple attr with different names within the same .

For example:

<declare-styleable name="CustomView">
    <attr name="font" />
    <attr name="leftFont" />
    <attr name="rightFont" />
</declare-styleable>

Instead of defining the enum multiple times, I am trying to find a way to have the enum defined once, but to have font, leftFont, rightFont all using the same enum list.

Does anyone know how this can be accomplished?

Edit: I am well aware of how to define the attr globally and reference it in multiple declare-styleable. This question is to use the enum in multiple attr with different names.

  • 1
    This is not a duplicate. I am well aware of how to define the attr globally and reference it in multiple declare-styleable. This question is to use the enum in multiple attr with different names. – Steve Tucker Jun 07 '17 at 22:56

1 Answers1

0

As the name is only parameter of attr that serves as key, the answer is: no.. umfortunetly it is not possible..

You have to make identical enums with different names.

convexHull
  • 1,761
  • 2
  • 15
  • 18