protected override void OnLayout(bool changed, int left, int top, int right, int bottom)
        {
            base.OnLayout(changed, left, top, right, bottom);
            float density = Context.Resources.DisplayMetrics.Density;

            mDiameter = Math.Min(MeasuredWidth, MeasuredHeight);
            if (mDiameter <= 0)
            {
                mDiameter = (int)density * DEFAULT_CIRCLE_DIAMETER;
            }
            if (Background == null && mCircleBackgroundEnabled)
            {
                int shadowYOffset = (int)(density * Y_OFFSET);
                int shadowXOffset = (int)(density * X_OFFSET);
                mShadowRadius = (int)(density * SHADOW_RADIUS);

                if (ElevationSupported())
                {
                    mBgCircle = new ShapeDrawable(new OvalShape());
                    ViewCompat.SetElevation(this, SHADOW_ELEVATION * density);
                }
                else
                {
                    OvalShape oval = new OvalShadow(mShadowRadius, mDiameter, this);
                    mBgCircle = new ShapeDrawable(oval);
                    ViewCompat.SetLayerType(this, ViewCompat.LayerTypeSoftware, mBgCircle.Paint);
                    mBgCircle.Paint.SetShadowLayer(mShadowRadius, shadowXOffset, shadowYOffset,
                                                   KEY_SHADOW_COLOR);
                    int padding = (int)mShadowRadius;
                    SetPadding(padding, padding, padding, padding);
                }
                mBgCircle.Paint.Color = mBackGroundColor;
                SetBackgroundDrawable(mBgCircle);
            }
            mProgressDrawable.SetBackgrounColor(mBackGroundColor);
            mProgressDrawable.SetColorSchemeColors(mColors);
            mProgressDrawable.SetSizeParameters(mDiameter, mDiameter,
                                                mInnerRadius <= 0 ? (mDiameter - mProgressStokeWidth * 2) / 4 : mInnerRadius,
                                                mProgressStokeWidth,
                                                mArrowWidth < 0 ? mProgressStokeWidth * 5 : mArrowWidth,
                                                mArrowHeight < 0 ? mProgressStokeWidth * 2 : mArrowHeight);
            if (IsShowArrow())
            {
                mProgressDrawable.SetArrowScale(1f);
                mProgressDrawable.ShowArrow(true);
            }
            base.SetImageDrawable(null);
            base.SetImageDrawable(mProgressDrawable);
            mProgressDrawable.SetAlpha(255);
            mProgressDrawable.Start();
        }
        protected override void OnLayout(bool changed, int left, int top, int right, int bottom)
        {
            base.OnLayout(changed, left, top, right, bottom);
            float density = Context.Resources.DisplayMetrics.Density;
            mDiameter = Math.Min(MeasuredWidth, MeasuredHeight);
            if (mDiameter <= 0)
            {
                mDiameter = (int)density * DEFAULT_CIRCLE_DIAMETER;
            }
            if (Background == null && mCircleBackgroundEnabled)
            {
                int shadowYOffset = (int)(density * Y_OFFSET);
                int shadowXOffset = (int)(density * X_OFFSET);
                mShadowRadius = (int)(density * SHADOW_RADIUS);

                if (ElevationSupported())
                {
                    mBgCircle = new ShapeDrawable(new OvalShape());
                    ViewCompat.SetElevation(this, SHADOW_ELEVATION * density);
                }
                else
                {
                    OvalShape oval = new OvalShadow(mShadowRadius, mDiameter, this);
                    mBgCircle = new ShapeDrawable(oval);
                    ViewCompat.SetLayerType(this, ViewCompat.LayerTypeSoftware, mBgCircle.Paint);
                    mBgCircle.Paint.SetShadowLayer(mShadowRadius, shadowXOffset, shadowYOffset,
                        KEY_SHADOW_COLOR);
                    int padding = (int)mShadowRadius;
                    SetPadding(padding, padding, padding, padding);
                }
                mBgCircle.Paint.Color = mBackGroundColor;
                SetBackgroundDrawable(mBgCircle);
            }
            mProgressDrawable.SetBackgrounColor(mBackGroundColor);
            mProgressDrawable.SetColorSchemeColors(mColors);
            mProgressDrawable.SetSizeParameters(mDiameter, mDiameter,
                mInnerRadius <= 0 ? (mDiameter - mProgressStokeWidth * 2) / 4 : mInnerRadius,
                mProgressStokeWidth,
                mArrowWidth < 0 ? mProgressStokeWidth * 5 : mArrowWidth,
                mArrowHeight < 0 ? mProgressStokeWidth * 2 : mArrowHeight);
            if (IsShowArrow())
            {
                mProgressDrawable.SetArrowScale(1f);
                mProgressDrawable.ShowArrow(true);
            }
            base.SetImageDrawable(null);
            base.SetImageDrawable(mProgressDrawable);
            mProgressDrawable.SetAlpha(255);
            mProgressDrawable.Start();
        }