Thursday, 5 September 2013

Is there a way to pass custom XML attributes to a class that extends View?

Is there a way to pass custom XML attributes to a class that extends View?

Assuming I have something that looks like this:
public class MyExcellentView extends View{
//etc. etc.
}
and in the xml I use it thusly:
<com.my.package.MyExcellentView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
myCustomAttribute="100"
/>
Is there a way to get access to myCustomAttribute within MyExcellentView?

No comments:

Post a Comment