I need to add indeterminate number of textview to a view, and I would love if it can be auto adjust to the screen.
What I tried is to add horizontal LinearLayouts to a vertical parent LinearLayout, but this way I can add maybe 2 items or 3 per line but it doesn't have this unordered effect.
Is there any way to achieve this?
What i suggest is to not create dynamically a horizontal layout (if you are doing that).
instead you can create a horizontal layout resource like this:
And then in your main activity do like this:
Where mainL is main vertical layout, to which you can add padding, or you can modify your horizontal one, it depends on what you want to achive.
In this example i used a for loop just to show you that 3 lines are created, in every cicle if you have a list of text to put in you could use this syntax for loop
reference: https://kotlinlang.org/docs/tutorials/kotlin-for-py/loops.html
For your specific case i suggest to have the main layout with padding start and end, and in horizontal layout margin top and bottom to create space between elements.