Android Programming: The Big Nerd Ranch Guide, 5th Edition
by Bryan Sills, Brian Gardner, Kristin Marsicano, Chris Stewart
Creating a Custom View
Android provides many excellent standard views, but sometimes you need a custom view that presents visuals that are unique to your app.
While there are all kinds of custom views, you can shoehorn them into two broad categories:
|
simple |
A simple view may be complicated inside; what makes it “simple” is that it has no child views. A simple view will almost always perform custom rendering. |
|
composite |
Composite views are composed of other view objects. Composite views typically manage child views but do not perform custom rendering. Instead, rendering is delegated to each child view. |
There are three steps to follow when creating a custom view:
-
Pick a superclass. For a simple custom ...
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