Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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 ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
186 views
Welcome To Ask or Share your Answers For Others

1 Answer

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);


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...