ScaleAnimation后如何获取View新的宽高
我使用 ScaleAnimation 来调整 ImageView 的大小。但是动画完成后,如何获取 ImageView 或其中位图的尺寸。 谢谢
这是我的代码:
ScaleAnimation animation = new ScaleAnimation(m_oldZoomRatio, m_currentZoomRatio, m_oldZoomRatio, m_currentZoomRatio);
animation.setFillAfter(true);
animation.setFillEnabled(true);
animation.setAnimationListener(new AnimationListener() {
public void onAnimationStart(Animation animation) {
}
public void onAnimationRepeat(Animation animation) {
}
public void onAnimationEnd(Animation animation) {
}
});
m_child.startAnimation(animation);
其中m_oldZoomRatio!= m_currentZoomRatio
。
我可以看到我的视图在运行时改变了布局。但是,当获取其宽度和高度时,我会在创建视图时收到原始值。
I used a ScaleAnimation
to resize my ImageView
. But after the animation is complete, how can I get the dimension of my ImageView
or the bitmap in that.
Thanks
Here is my code:
ScaleAnimation animation = new ScaleAnimation(m_oldZoomRatio, m_currentZoomRatio, m_oldZoomRatio, m_currentZoomRatio);
animation.setFillAfter(true);
animation.setFillEnabled(true);
animation.setAnimationListener(new AnimationListener() {
public void onAnimationStart(Animation animation) {
}
public void onAnimationRepeat(Animation animation) {
}
public void onAnimationEnd(Animation animation) {
}
});
m_child.startAnimation(animation);
Where m_oldZoomRatio != m_currentZoomRatio
.
I can see my view changes its layout while running. But when get its width and height, I receive the value in original when the view is created.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用动画侦听器,在动画结束时您可以更改宽度和高度
try to use animation listener where on animation end you can change the width and height