22
You need to implement these constructors also:
//Constructor that is called when inflating a view from XML.
View(Context context, AttributeSet attrs)
//Perform inflation from XML and apply a class-specific base style.
View(Context context, AttributeSet attrs, int defStyle)