OSDN Git Service

Doc changes for GridLayout.
authorPhilip Milne <pmilne@google.com>
Mon, 21 May 2012 17:44:46 +0000 (10:44 -0700)
committerPhilip Milne <pmilne@google.com>
Mon, 21 May 2012 17:46:56 +0000 (10:46 -0700)
Add some javadoc to explain orientation property properly.

Change-Id: I1e2092f32fe2f524eda7d1c46c6daad571733c1f

core/java/android/widget/GridLayout.java

index 60a1d15..772d748 100644 (file)
@@ -294,8 +294,32 @@ public class GridLayout extends ViewGroup {
     }
 
     /**
-     * Orientation is used only to generate default row/column indices when
-     * they are not specified by a component's layout parameters.
+     *
+     * GridLayout uses the orientation property for two purposes:
+     * <ul>
+     *  <li>
+     *      To control the 'direction' in which default row/column indices are generated
+     *      when they are not specified in a component's layout parameters.
+     *  </li>
+     *  <li>
+     *      To control which axis should be processed first during the layout operation:
+     *      when orientation is {@link #HORIZONTAL} the horizontal axis is laid out first.
+     *  </li>
+     * </ul>
+     *
+     * The order in which axes are laid out is important if, for example, the height of
+     * one of GridLayout's children is dependent on its width - and its width is, in turn,
+     * dependent on the widths of other components.
+     * <p>
+     * If your layout contains a {@link TextView} (or derivative:
+     * {@code Button}, {@code EditText}, {@code CheckBox}, etc.) which is
+     * in multi-line mode (the default) it is normally best to leave GridLayout's
+     * orientation as {@code HORIZONTAL} - because {@code TextView} is capable of
+     * deriving its height for a given width, but not the other way around.
+     * <p>
+     * Other than the effects above, orientation does not affect the actual layout operation of
+     * GridLayout, so it's fine to leave GridLayout in {@code HORIZONTAL} mode even if
+     * the height of the intended layout greatly exceeds its width.
      * <p>
      * The default value of this property is {@link #HORIZONTAL}.
      *
@@ -1373,6 +1397,7 @@ public class GridLayout extends ViewGroup {
                             break;
                         }
                         case PENDING: {
+                            // le singe est dans l'arbre
                             assert false;
                             break;
                         }