/// <summary>Add a new layer to this drawable.</summary> /// <remarks>Add a new layer to this drawable. The new layer is identified by an id.</remarks> /// <param name="layer">The drawable to add as a layer.</param> /// <param name="id">The id of the new layer.</param> /// <param name="left">The left padding of the new layer.</param> /// <param name="top">The top padding of the new layer.</param> /// <param name="right">The right padding of the new layer.</param> /// <param name="bottom">The bottom padding of the new layer.</param> private void addLayer(android.graphics.drawable.Drawable layer, int id, int left, int top, int right, int bottom) { android.graphics.drawable.LayerDrawable.LayerState st = mLayerState; int N = st.mChildren != null ? st.mChildren.Length : 0; int i = st.mNum; if (i >= N) { android.graphics.drawable.LayerDrawable.ChildDrawable[] nu = new android.graphics.drawable.LayerDrawable .ChildDrawable[N + 10]; if (i > 0) { System.Array.Copy(st.mChildren, 0, nu, 0, i); } st.mChildren = nu; } mLayerState.mChildrenChangingConfigurations |= layer.getChangingConfigurations(); android.graphics.drawable.LayerDrawable.ChildDrawable childDrawable = new android.graphics.drawable.LayerDrawable .ChildDrawable(); st.mChildren[i] = childDrawable; childDrawable.mId = id; childDrawable.mDrawable = layer; childDrawable.mInsetL = left; childDrawable.mInsetT = top; childDrawable.mInsetR = right; childDrawable.mInsetB = bottom; st.mNum++; layer.setCallback(this); }
public int addChild(android.graphics.drawable.Drawable dr) { int pos = mNumChildren; if (pos >= mDrawables.Length) { growArray(pos, pos + 10); } dr.setVisible(false, true); dr.setCallback(mOwner); mDrawables[pos] = dr; mNumChildren++; mChildrenChangingConfigurations |= dr.getChangingConfigurations(); mHaveOpacity = false; mHaveStateful = false; mConstantPadding = null; mPaddingChecked = false; mComputedConstantSize = false; return pos; }