O'Reilly logo

Building Android UIs with Custom Views by Raimon Ràfols Montané

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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"/> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required