Android provides several layouts to position our views in many different ways, but if these standard layouts aren't useful for our specific use case, we can create our own layouts.
Creating a custom layout
Extending ViewGroup
The process to create a custom layout is quite similar to creating a custom view. We've got to create a class that extends from ViewGroup instead of view, create the appropriate constructors, implement the onMeasure() method, and override the onLayout() method rather than the onDraw() method.
Let's create a very simple custom layout; it will add elements to the right of the previous element until it doesn't fit on the screen, then it'll start a new row, using the higher element...