Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
193 views
in Technique[技术] by (71.8m points)

android - Animation Drawable gets automatically shrinks at the corners ?

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

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

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...