Define the required attribute for <declare-stylable>

Can styled attributes be defined as required ? (as in XSD schemes)

<declare-styleable name="PieChart"> <attr name="name" format="string" use="required"/> </declare-styleable> 

The above XML does not work, is there any other syntax to achieve it?

+4
source share
1 answer

What if you selected an exception in your constructor if attr is null?

0
source

All Articles