how to add views inside a custom View?

Your custom view needs to extend ViewGroup or one of the other classes that extends ViewGroup. For example, you could extend from RelativeLayout or LinearLayout if those layouts fits what your custom view needs to do.

Remember, even the layout classes are just another View. They just happen to have methods to add other views as children and have code to recursively measure and draw their children.


I would try extending some kind of Layout. Remember that (for the most part) they are also treated as Views. For more information/deciding which Layout to pick, try looking here:

http://developer.android.com/guide/topics/ui/layout-objects.html