Here are the steps :
- create the custom view xml.
- Now add the <declare-styleable... tags just like in the photo
- Create a class and extend from Linear Layout , Relative Layout
- Use the custom view in your xml layout.
More details inside the article.
Original article here .