O'Reilly logo

Android Programming: The Big Nerd Ranch Guide by Brian Hardy, Bill Phillips

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

Creating a Custom View

Android provides many excellent standard views and widgets, but sometimes you need a custom view that presents visuals that are totally 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 as well.

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.

Here are three steps to follow when creating a custom view:

  • Pick a superclass. For a simple custom view, View is a blank ...

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