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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.