I am applying Animation Drawable with some smoke like animation. It works properly everywhere except at the corners/edges of the screen. Android automatically shrinks the Imageview of Animation Drawable at the corners and the animation does not happen at the proper position because of the shrink ? I want my animation Drawable to go out of the screen bound but it should show the proper animation at the corners.
What I am doing is
mAnimation = new ImageView(this);
mAnimation.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
mAnimation.setVisibility(View.VISIBLE);
mlp.setMargins(click_X, click_Y, 0, 0);
mAnimation.setLayoutParams(mlp);
mAnimation.setBackgroundDrawable(this.getResources().getDrawable(R.drawable.smoke));
AnimationDrawable anim = (AnimationDrawable) mAnimation.getBackground();
if (anim != null) {
anim.start();
}
now this imageview Animation gets shrink if we click at the edges of the screen ?
I have solved by myself we need to add the right Margin also and if it shrinks at the bottom then we need to add the bottom margin also instead of 0. This solves the problem of shrinking at the edges
mlp.setMargins(click_X, click_Y, click_X /2,Click_Y/2);