简体   繁体   English

在canvas.scale android之后验证sharedelement过渡

[英]validate sharedelement transition after canvas.scale android

I did a couple of google searches and couldnt figure this one out. 我做了几个谷歌搜索,无法解决这个问题。 I am trying to duplicate the google photo behaviour that when one pinches a image the image transitions back to the place. 我正在尝试复制Google的照片行为,即当人捏图像时,图像会转换回该位置。

everything is working. 一切正常。 the only problem is when the back transition is happening the transition happends from the old full size image. 唯一的问题是发生向后过渡时,过渡是从旧的原尺寸图像发生的。

to be more clear i scale the canvas of the rootview of my activity so that everything inside the activity is scaled down. 更清楚地说,我缩放了我的活动的rootview的画布,以便缩小活动中的所有内容。 in this case the content inside the rootview is just a image. 在这种情况下,rootview内的内容只是一个图像。 in the end of the pinch the scalefactor will be 0.5f. 在收缩结束时,比例因子将为0.5f。 (50% of the normal size) then the return transition takes place and the problem happends. (正常大小的50%),则发生返回转换,并发生了问题。 the transition scales up to the original(100%) size before animating, this makes it look like the scaling of the canvas never happend. 动画前过渡会放大到原始(100%)大小,这使画布看起来从未发生过缩放。

i hope this is clear english is not my native language. 我希望这很清楚,英语不是我的母语。

code: 码:

    canvas.save(Canvas.MATRIX_SAVE_FLAG);
    canvas.scale(mScaleFactor, mScaleFactor,mScreenX,mScreenY);

    canvas.rotate(mRotationDegree,mScreenX,mScreenY);

    super.dispatchDraw(canvas);
    canvas.restore();

我发现画布不会一直更新,我在视图组上转换为setScaleY和setScaleX

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM