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.
try to use animation listener where on animation end you can change the width and height
<animation-object>.setAnimationListener(new AnimationListener()
{
@Override
public void onAnimationEnd(Animation arg0) {
img.getWidth();
img.getHeight();
//OR
int h=img.getLayoutParams().height;
int w=img.getLayoutParams().width;
// For changing actual height and width
view.getLayoutParams().width = newWidth;
view.getLayoutParams().height = newHeight;
view.requestLayout();
}
@Override
public void onAnimationRepeat(Animation arg0) {
}
@Override
public void onAnimationStart(Animation arg0) {
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With