I searched here on SO, on Google, on the android docs...
But I cannot find a single snippet of code with a example of custom viewgroup, I find at most some vague explanations...
Can someone provide one? How you make a viewgroup where you can put its children where you want?
I think the simplest example to look at is the source for AbsoluteLayout.java
You need to override onMeasure to measure the children and onLayout to position them.
I have strikingly more complicated ViewGroup code I can share as well if you want.
来源:https://stackoverflow.com/questions/5663068/custom-viewgroup-example