I was wondering what the difference are between these two? benefits of one over the other? etc...
Horizontal lines, as we know, follow the horizon, so they go straight across. Vertical lines go up and down. As this works with other elements to bring an image together, you either get a horizontal image or a vertical one.
LinearLayout is a view group that aligns all children in a single direction, vertically or horizontally. You can specify the layout direction with the android:orientation attribute.
Linear Layout You can specify whether that line is horizontal or vertical by using the android:orientation attribute. By default, orientation is horizontal. Horizontal orientation will only have one single row of elements on the screen and in the case of vertical orientation, it will only have one child per row.
In a nutshell, layout_weight specifies how much of the extra space in the layout to be allocated to the View. LinearLayout supports assigning a weight to individual children. This attribute assigns an "importance" value to a view, and allows it to expand to fill any remaining space in the parent view.
"horizontal" allows your elements within the Layout to be placed beside each other where as "vertical" will stack them. There aren't really benefits to either - use the one that best fits your design.
The official documentation says: "Should the layout be a column or a row? Use "horizontal" for a row, "vertical" for a column."
As far as I know they are only relevant for the LinearLayout. And it determines wither your views get stacked vertically like this:
View1
View2
View3
View4
etc...
or horizontally like this:
View1 View2 View3 View4 etc...
horizontal:
# # # # # # # # # # #
vertical:
#
#
#
#
#
#
#
#
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With