1

Is there a way to get styleable by name, for example if I have string "Text" is it possible to get R.styleable.CustomView_Text value (by value I mean just index in R.styleable.CustomView array, not attribute value) without reflection?

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

    <declare-styleable name="CustomView">

        <attr name="Text" format="string" />

    </declare-styleable>

</resources>
zduny
  • 2,481
  • 1
  • 27
  • 49

1 Answers1

0

Use the Resources.getIdentifier method, setting the defType param as 'styleable'.

Che Jami
  • 5,151
  • 2
  • 21
  • 18