Making it configurable

In the initial chapters of this book, we introduced how to add parameters and, that way, easily customize our custom view. Following the same principles, we have created an attrs.xml file with all the customizable parameters:

 

<?xml version="1.0" encoding="utf-8"?> <resources> <declare-styleable name="EPG"> <attr name="backgroundColor" format="color"/> <attr name="programColor" format="color"/> <attr name="highlightedProgramColor" format="color"/> <attr name="currentTimeColor" format="color"/> <attr name="channelTextColor" format="color"/> <attr name="programTextColor" format="color"/> <attr name="highlightedProgramTextColor" format="color"/> <attr name="timeBarColor" format="color"/> <attr name="channelHeight" format="float"/> ...

Get Building Android UIs with Custom Views now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.