android-art-res icon indicating copy to clipboard operation
android-art-res copied to clipboard

[error] P268 页中scale、rotate的pivotX、pivotY默认都为0,而不是view的中心点

Open onlylemi opened this issue 7 years ago • 2 comments

已经过测试验证。P268 页中提到 View 动画,scale、rotate的pivotX、pivotY轴心点默认都为0,而不是view的中心点。

RotateAnimation 的构造函数

    public RotateAnimation(float fromDegrees, float toDegrees) {
        mFromDegrees = fromDegrees;
        mToDegrees = toDegrees;
       // 默认为0.0,也就是view的左上点坐标
        mPivotX = 0.0f;
        mPivotY = 0.0f;
    }

ScaleAnimation 的构造函数

    public ScaleAnimation(float fromX, float toX, float fromY, float toY) {
        mResources = null;
        mFromX = fromX;
        mToX = toX;
        mFromY = fromY;
        mToY = toY;
        mPivotX = 0;
        mPivotY = 0;
    }

onlylemi avatar Jul 13 '16 13:07 onlylemi

I agree

lzhui1994 avatar Dec 04 '16 12:12 lzhui1994

I saw that in the resourceCode

lzhui1994 avatar Dec 04 '16 12:12 lzhui1994