在Android中从上到下移动图像视图



我在屏幕的中心有一个imageView,我想向上移动。它留在顶部。我看到了补间动画文档并尝试了它,但它不起作用。任何一个可以帮助我解决这个问题。

您是否尝试过查看动画?

Animation an = new TranslateAnimation(fromX,fromY,toX,toY);//0,0 is the current       coordinates
an.setFillAfter(true);// to keep the state after animation is finished
yourView.startAnimation(an);// to start animation obviously

使其从下部移到顶部,获取屏幕高度并使用它设置"玩具"参数。

几次尝试后,您肯定会这样做。

最新更新