public virtual void setStroke(int width, int color, float dashWidth, float dashGap ) { mGradientState.setStroke(width, color, dashWidth, dashGap); if (mStrokePaint == null) { mStrokePaint = new android.graphics.Paint(android.graphics.Paint.ANTI_ALIAS_FLAG); mStrokePaint.setStyle(android.graphics.Paint.Style.STROKE); } mStrokePaint.setStrokeWidth(width); mStrokePaint.setColor(color); android.graphics.DashPathEffect e = null; if (dashWidth > 0) { e = new android.graphics.DashPathEffect(new float[] { dashWidth, dashGap }, 0); } mStrokePaint.setPathEffect(e); invalidateSelf(); }
internal void initializeWithState(android.graphics.drawable.GradientDrawable.GradientState state) { if (state.mHasSolidColor) { mFillPaint.setColor(state.mSolidColor); } mPadding = state.mPadding; if (state.mStrokeWidth >= 0) { mStrokePaint = new android.graphics.Paint(android.graphics.Paint.ANTI_ALIAS_FLAG); mStrokePaint.setStyle(android.graphics.Paint.Style.STROKE); mStrokePaint.setStrokeWidth(state.mStrokeWidth); mStrokePaint.setColor(state.mStrokeColor); if (state.mStrokeDashWidth != 0.0f) { android.graphics.DashPathEffect e = new android.graphics.DashPathEffect(new float [] { state.mStrokeDashWidth, state.mStrokeDashGap }, 0); mStrokePaint.setPathEffect(e); } } }