I do not want to use TableLayout because my data model and UI perfectly fit into ListView. But I need to have fields in list items to organize in columns through hole ListView. I want to use two-line list item model with about 4-5 columns in a second line. I do know how to make custom layouts and custom array adapters for ListView. The question is about positioning TextView‘s in a list item custom layout so that they become nicely aligned. Surely I can not use absolute widths because there are so many screen sizes, but I can not think of any other option.
I do not want to use TableLayout because my data model and UI perfectly
Share
If you wrap your
TextViewsin aLinearLayoutthen you can use thelayout_weightattribute:This will make your
TextViewoccupy 25% of the available width and should keep them vertical aligned(you could also set the gravity for theTexViewto left). The above code is an example for 4TextViews, if you have more or less you must adapt thelayout_weightattribute so that the sum of all thelayout_weightattributes is 100.I hope this is what you want.