规模及放大器;翻译动画 [英] Scale & Translate animation

查看:136
本文介绍了规模及放大器;翻译动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个动画在我的应用程序中的图像。 图像应该开始从左上角到屏幕中间到来。图像尺寸将是在初始阶段小。而来到屏幕中间,其大小应增加(即缩放应该发生)。图像不应回到原来的位置。应当放置在屏幕本身的动画之后的中间

I require an animation for an image in my application. The image should start coming from the top left corner till the middle of screen. The image size will be smaller at the initial stage. While coming to the middle of the screen, its size should increase(i.e. scaling should take place). Image should not go back to its original position. It should be placed at the middle of the screen itself after the animation.

任何人都可以请帮助。

推荐答案

请在这里找到答案。 创建内部/ RES /动画文件夹中的XML,并把下面的code进去。

Please find the answer here. Create an xml inside /res/anim folder and put the below code into it.

<?xml version="1.0" encoding="utf-8"?> 
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator">
   <scale android:fromXScale="0.0" android:fromYScale="0.0"
          android:toXScale="1.0" android:toYScale="1.0" 
          android:duration="700" android:fillBefore="false" />
   <translate android:fromXDelta="-200" android:fromYDelta="-200"
          android:duration="700" />
</set>

将低于code在java文件中:

Place the below code inside the java file:

Animation logoMoveAnimation = AnimationUtils.loadAnimation(this, R.anim.logoanimation); 
logoIV.startAnimation(logoMoveAnimation);

logoanimation是我的动画的XML文件的名称。

logoanimation is the name of my animation xml file.

感谢所有那些谁尝试了我的问题。

Thanks for all those who tried out for my question.

这篇关于规模及放大器;翻译动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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