views:

11

answers:

1

I'm reading the android docs on custom component development and i'm a little confused. If you're creating an activity, you can add add a hierarchy of views via setContent. however, if you're creating a custom component, you have to handle everything in the draw() overload.

if i want to build a custom component that relies on a view hierarchy, is the model simply to create a hierarchy internally and then in draw call myViewHierarchy.Draw() or something?

A: 

however, if you're creating a custom component, you have to handle everything in the draw() overload.

Not necessarily. That's one approach, but hardly the only one.

if i want to build a custom component that relies on a view hierarchy, is the model simply to create a hierarchy internally and then in draw call myViewHierarchy.Draw() or something?

No. Just add children to a container, then add logic to the container for representing the composite widget. For example, I have a ColorMixer custom component that combines three SeekBars, three TextViews (labels for the SeekBars), and a plain View (used to provide a color swatch).

CommonsWare
Got it. thanks.
bryan costanich