I want to create a custom Android View (MyCustomView). In this View I want to have a property of a custom Type (MyCustomType). Similar to this:
MyCustomView extends LinearLayout { private MyCustomType prop1; public MyCustomType getProp1() { return this.prop1; } public void setProp1(MyCustomType value) { this.prop1 = value;} } } So far so good. But now I want to be able to set the value of this property from XML. I can create a custom attribute with string, int, reference format, but I do not see how to define this attribute to be of MyCustomType format. I image something similar to this:
<declare-styleable name="MyCustomView"> <attr name="prop1" format="MyCustomType"/> </declare-styleable> Is this possible somehow? Or custom type attributes are possible to be set only from code behind?
Thank you!