It is possible, but not easy. You will need to create your own layout. See the source code on LinearLayout for an example, specifically layoutHorizontal ().
You will override ViewGroup.onLayout (). In it, you will check the size of your children using View.getMeasured {Width, Height} (), making sure that they can fit in a row or move on to the next.
Matthew willis
source share