Chapter 8. Drawing 2D and 3D Graphics
The Android menagerie of widgets and the tools for assembling them are convenient and powerful, and cover a broad variety of needs. What happens, though, when none of the existing widgets offer what you need? Maybe your application needs to represent playing cards, phases of the moon, or the power diverted to the main thrusters of a rocket ship. In that case, you’ll have to know how to roll your own.
This chapter is an overview of graphics and animation on Android. It’s directed at programmers with some background in graphics, and goes into quite a bit of depth about ways to twist and turn the display. You will definitely need to supplement the chapter with Android documentation, particularly because the framework is still changing. A major change in implementation, around the time of Honeycomb, for instance, takes better advantage of hardware acceleration. It also substantially affects the ways in which an application can optimize its drawing. Still, the techniques here will help you dazzle your users.
Rolling Your Own Widgets
As mentioned earlier,
widget is just a convenient term for a subclass of
android.view.View
, typically a leaf
node in the view tree, that implements both a view and its controller.
Internal nodes in the view tree, though they may contain complex code,
tend to have simpler user interactions. The term
widget, although informal, is usually reserved for discussing the workhorse parts of the user interface: those that have the ...
Get Programming Android, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.