10. Creating Custom Views

The Android view framework provides a rich visual toolkit with which to create your application UI. However, you may find that the functionality you need is not available in the stock views. For those cases, Android allows you to create a custom view that will better match your needs. In this chapter, you will learn that Android draws views in two passes, a measure phase and a layout phase; that you should override the onMeasure and onDraw methods when creating a custom view; that using custom view attributes requires that you declare a new XML namespace for those attributes; and that compound views combine multiple views into a custom component.

Understanding How Android Draws Views

Before learning how to create custom ...

Get Android UI Fundamentals: Develop and Design now with O’Reilly online learning.

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