code: public void setLayerGravity(int index, int gravity) {
          final ChildDrawable childDrawable = mLayerState.mChildren[index];
          childDrawable.mGravity = gravity;
      }
docs: Sets the gravity used to position or stretch the specified layer within its container.
  Gravity is applied after any layer insets (see {@link #setLayerInset(int, int, int, int,
  int)}) or padding (see {@link #setPaddingMode(int)}).
  <p/>
  If gravity is specified as {@link Gravity#NO_GRAVITY}, the default behavior depends on
  whether an explicit width or height has been set (see {@link #setLayerSize(int, int, int)}),
  If a dimension is not set, gravity in that direction defaults to {@link
  Gravity#FILL_HORIZONTAL} or {@link Gravity#FILL_VERTICAL}; otherwise, gravity in that
  direction defaults to {@link Gravity#LEFT} or {@link Gravity#TOP}.
  
  @param index   the index of the drawable to adjust
  @param gravity the gravity to set for the layer
  @attr ref android.R.styleable#LayerDrawableItem_gravity
  @see #getLayerGravity(int)