Custom Components in Android

Custom Components

Compound Controls

Here are steps involved in creating a custom layout

Inherit from ViewGroup
Override OnMeasure
  Use a pencil and paper to figure out your algorithm
  Use ViewGroup.measureChild(). Don't directly use child.measure()
  (Unless you know what you are doing)
  Use layout params to stuff the origin of each child view
  Take into accound padding
Override OnLayout
  Just retrieve the layout param object and use its origin
Implement custom LayoutParams
Override layout params construction methods
Test it with exact, match parent, wrap content, and weights

3) Custom views

23-Oct-12

Custom views

Customizing a View: Essential Code Snippets

5) Date Controls

30-Oct-12

Date Controls

How do you work with a surface view?

Managing View State in Android: Techniques and Approaches

8) On MeasureSpec

23-Oct-12

On MeasureSpec

onMeasure, onLayout, onDraw: Briefly speaking

Principles of Compound Controls: A semi article

Principles of Custom Layouts: A semi article

Reading custom attributes

13) Responding to events

23-Oct-12

Responding to events

The dispatch pattern in Android

Understand Android layout internals

What can you use the Hierarchy Viewer for?

17) Working with 2D graphics

19-Oct-12

Working with 2D graphics