Configurable
We've explained in Chapter 2, Implementing Your First Custom View, how to parameterize a custom view. We've created it because it might serve a very specific purpose, but in general the more configurable it is, the more likely it will be used somewhere else.
Imagine we're building a progress bar. If our custom view always draws a horizontal red bar, it'll have its uses but not many as it's too specific. If we allow the developer of the application using this custom view to customize the color of the bar, we'd add several other use cases for it. If, in addition, we also allow developers to configure the background color or what kind of primitive we're drawing instead of a horizontal bar, we'll cover even more different scenarios ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access