动画绘制对象自动获得缩在角落? [英] Animation Drawable gets automatically shrinks at the corners ?

查看:136
本文介绍了动画绘制对象自动获得缩在角落?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在申请动画绘制对象像动画一些烟雾。它工作正常,除了无处不在屏幕的角落/边缘。 Android的自动缩小动画绘制对象的ImageView的在弯道和动画完全不因收缩的适当位置发生?我希望我的动画绘制对象走出去约束屏幕,但它应该显示在角落适当的动画。

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.

我在做什么是

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

现在如果我们点击屏幕的边缘,这ImageView的动画被缩水?

now this imageview Animation gets shrink if we click at the edges of the screen ?

推荐答案

我已经自己解决了,我们需要添加合适的保证金也,如果它缩小底部那么我们还需要补充,而不是0下边距。这解决了在边缘收缩的问题
mlp.setMargins(click_X,click_Y,click_X / 2,Click_Y / 2);

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

这篇关于动画绘制对象自动获得缩在角落?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆