Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding Views to an Android Viewgroup Programmatically

This seems to be a common question yet documentation is very hard to find. I'm looking for examples that show me how to create my own view group (preferably by extending an already existing one) and then add views programmaticly.

Thanks.

like image 881
Matt Gould Avatar asked Sep 30 '11 16:09

Matt Gould


1 Answers

ViewGroup

ViewGroup is abstract, and its onLayout is abstract too. So you need to provide an implementation for onLayout where you do assign a position at every child (View) of the viewgroup.

like image 77
Blackbelt Avatar answered Oct 03 '22 02:10

Blackbelt