Skip to content

Commit b65408f

Browse files
author
Philip Milne
committed
Doc changes for GridLayout.
Add some javadoc to explain orientation property properly. Change-Id: I1e2092f32fe2f524eda7d1c46c6daad571733c1f
1 parent 45131d0 commit b65408f

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

core/java/android/widget/GridLayout.java

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,32 @@ public int getOrientation() {
294294
}
295295

296296
/**
297-
* Orientation is used only to generate default row/column indices when
298-
* they are not specified by a component's layout parameters.
297+
*
298+
* GridLayout uses the orientation property for two purposes:
299+
* <ul>
300+
* <li>
301+
* To control the 'direction' in which default row/column indices are generated
302+
* when they are not specified in a component's layout parameters.
303+
* </li>
304+
* <li>
305+
* To control which axis should be processed first during the layout operation:
306+
* when orientation is {@link #HORIZONTAL} the horizontal axis is laid out first.
307+
* </li>
308+
* </ul>
309+
*
310+
* The order in which axes are laid out is important if, for example, the height of
311+
* one of GridLayout's children is dependent on its width - and its width is, in turn,
312+
* dependent on the widths of other components.
313+
* <p>
314+
* If your layout contains a {@link TextView} (or derivative:
315+
* {@code Button}, {@code EditText}, {@code CheckBox}, etc.) which is
316+
* in multi-line mode (the default) it is normally best to leave GridLayout's
317+
* orientation as {@code HORIZONTAL} - because {@code TextView} is capable of
318+
* deriving its height for a given width, but not the other way around.
319+
* <p>
320+
* Other than the effects above, orientation does not affect the actual layout operation of
321+
* GridLayout, so it's fine to leave GridLayout in {@code HORIZONTAL} mode even if
322+
* the height of the intended layout greatly exceeds its width.
299323
* <p>
300324
* The default value of this property is {@link #HORIZONTAL}.
301325
*
@@ -1373,6 +1397,7 @@ void walk(int loc) {
13731397
break;
13741398
}
13751399
case PENDING: {
1400+
// le singe est dans l'arbre
13761401
assert false;
13771402
break;
13781403
}

0 commit comments

Comments
 (0)