layoutChanged(X_AXIS); layoutChanged(Y_AXIS);
layoutValid[X_AXIS] = false; requirementsValid[X_AXIS] = false; layoutValid[Y_AXIS] = false; requirementsValid[Y_AXIS] = false;
  public void replace(int offset, int length, View[] views)  {    int numViews = 0;    if (views != null)      numViews = views.length;    // Resize and copy data for cache arrays.    // The spansX cache.    int oldSize = getViewCount();    int[] newSpansX = new int[oldSize - length + numViews];    System.arraycopy(spans[X_AXIS], 0, newSpansX, 0, offset);    System.arraycopy(spans[X_AXIS], offset + length, newSpansX,                     offset + numViews,                     oldSize - (offset + length));    spans[X_AXIS] = newSpansX;    // The spansY cache.    int[] newSpansY = new int[oldSize - length + numViews];    System.arraycopy(spans[Y_AXIS], 0, newSpansY, 0, offset);    System.arraycopy(spans[Y_AXIS], offset + length, newSpansY,                     offset + numViews,                     oldSize - (offset + length));    spans[Y_AXIS] = newSpansY;    // The offsetsX cache.    int[] newOffsetsX = new int[oldSize - length + numViews];    System.arraycopy(offsets[X_AXIS], 0, newOffsetsX, 0, offset);    System.arraycopy(offsets[X_AXIS], offset + length, newOffsetsX,                     offset + numViews,                     oldSize - (offset + length));    offsets[X_AXIS] = newOffsetsX;    // The offsetsY cache.    int[] newOffsetsY = new int[oldSize - length + numViews];    System.arraycopy(offsets[Y_AXIS], 0, newOffsetsY, 0, offset);    System.arraycopy(offsets[Y_AXIS], offset + length, newOffsetsY,                     offset + numViews,                     oldSize - (offset + length));    offsets[Y_AXIS] = newOffsetsY;    // Actually perform the replace.    super.replace(offset, length, views);    // Invalidate layout information.    layoutChanged(X_AXIS);    layoutChanged(Y_AXIS);  }