Why do you need a GridLayout orientation?



  • The documentation says that this characteristic is not used in GridLayout, but first, it is there, and secondly, its change has an effect on the elements:

    orientation vertical введите сюда описание изображения

    Why is this happening?



  • The documentation is quite clear https://developer.android.com/reference/android/widget/GridLayout.html#attr_android:orientation :

    The orientation property is not used during layout. It is only used to allocate row and column parameters when they are not specified by its children's layout paramters. GridLayout works like LinearLayout in this case; putting all the components either in a single row or in a single column - depending on the value of this flag. In the horizontal case, a columnCount property may be additionally supplied to force new rows to be created when a row is full. The rowCount attribute may be used similarly in the vertical case. The default is horizontal.

    It is stated here that this parameter is not used in the view but has several other characteristics. I mean, the nature does not affect the layout of the loyaut, but the elements that it contains, which are on your screens, the parameter affects the appearances in each cell (if there are several) rather than the sequence of cells.

    The principle is that each cell GridLayout acting like LinearLayout (if not otherwise specified) and this is the part where the label is invested and the properties are specified (previously for all cells once).
    Everything on your screens is exactly what it says in the documentation.

    PS: You should read the documentation in full, not the first line.


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2