@Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); //圆心位置 centerX = w / 2; centerY = h / 2; maxRadius = (float) Math.sqrt(Math.pow(w / 2d, 2) + Math.pow(h / 2d, 2)) + 10; }
@Override protected void onSizeChanged(int width, int height, int oldWidth, int oldHeight) { super.onSizeChanged(width, height, oldWidth, oldHeight); loaderController.onSizeChanged(); }
@Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); width=w; height=h; x=0; y=0; rWidth=width-5; rHeight=height; }
@Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { mWidth = w; mHeight = h; super.onSizeChanged(w, h, oldw, oldh); }
@Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); tryInitEngine(w); }
@Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); superManager.buildShape(null); }
@Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); mRadiusUtils.onSizeChanged(w, h); }
@Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); //do nothing if it's width was not changed if (oldw == w){ return; } resetTextSizeIfNecessary(); }
@Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); breakManually(this, getEditableText()); }
@Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); if (mViewWidth == 0) { mViewWidth = getMeasuredWidth(); if (mViewWidth > 0) { mPaint = getPaint(); mLinearGradient = new LinearGradient( 0, 0, mViewWidth, 0, new int[]{ Color.DKGRAY, 0xffffffff, Color.DKGRAY }, null, Shader.TileMode.CLAMP); mPaint.setShader(mLinearGradient); mGradientMatrix = new Matrix(); } } } }
@Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); if (mViewWidth == 0) { mViewWidth = getMeasuredWidth(); if (mViewWidth > 0) { // 使用getPaint()方法获取当前绘制TextView的Paint对象, // 并给这个paint对象设置原生TextView没有的LinearGradient属性 Paint mPaint = getPaint(); mLinearGradient = new LinearGradient(0, 0, getMeasuredWidth(), 0, new int[]{Color.RED, Color.YELLOW, Color.BLUE, Color.GREEN}, null, Shader.TileMode.MIRROR); mPaint.setShader(mLinearGradient); mGradientMatrix = new Matrix(); } } }
@Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); paint = getPaint(); String text = getText().toString(); // 文字宽度 float textWidth = paint.measureText(text); Paint.FontMetrics fontMetrics = paint.getFontMetrics(); // 文字的总高度 float textHeight = fontMetrics.bottom - fontMetrics.top; // 文字的单个高度(即行高度) float textRowHeight = getTextSize(); row = (int) (textHeight / textRowHeight); int gradientSize = (int) (textWidth / text.length() * 3); linearGradient = new LinearGradient( -gradientSize, textRowHeight * curRow, 0, textRowHeight * curRow, new int[]{0x22ffffff, 0xffffffff, 0x22ffffff}, null, Shader.TileMode.CLAMP); paint.setShader(linearGradient); }
@Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); mWidth = w; mHeight = h; Drawable[] drawables = getCompoundDrawables(); Drawable drawableLeft = drawables[0]; Drawable drawableTop = drawables[1]; Drawable drawableRight = drawables[2]; Drawable drawableBottom = drawables[3]; if (drawableLeft != null) { setDrawable(drawableLeft, 0, drawableLeftWidth, drawableLeftHeight); } if (drawableTop != null) { setDrawable(drawableTop, 1, drawableTopWidth, drawableTopHeight); } if (drawableRight != null) { setDrawable(drawableRight, 2, drawableRightWidth, drawableRightHeight); } if (drawableBottom != null) { setDrawable(drawableBottom, 3, drawableBottomWidth, drawableBottomHeight); } this.setCompoundDrawables(drawableLeft,drawableTop,drawableRight,drawableBottom); }
@Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); roundRectShape .setWidth(w) .setHeight(10) .alignBottom(h); //clear olds anims shapeAnimator.clear(); //start animation shapeAnimator .setRepeatCount(ValueAnimator.INFINITE) .setDuration(1000) .play( roundRectShape.animate().left(roundRectShape.getLeft(), roundRectShape.getLeft() + 10, roundRectShape.getLeft()), roundRectShape.animate().right(roundRectShape.getRight(), roundRectShape.getRight() - 10, roundRectShape.getRight()) ) .start(); }