图片从中心到顶部的Andr​​oid翻译 [英] Translation of image from center to top in android

查看:153
本文介绍了图片从中心到顶部的Andr​​oid翻译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我都坚持与创建一个启动画面在图像被放置在center_vertical问题|中心horizo​​ntal.how到翻译器交给center_horizo​​ntal |顶部android.can任何一个请指导我该怎么办呢

解决方案

使用动画,要做到这一点,有关动画的看法,你可以参考的这个链接也的这个

你实际上是在寻找的东西在翻译从中心到屏幕顶部的视图,您可以使用翻译动画使用XML。

1,创建在资源文件夹中的文件夹阿尼姆 2.添加描述喜欢你的翻译效果的资源文件:

 <翻译的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:fromXDelta =50%P机器人:fromYDelta =50%P
    机器人:toXDelta =50%P机器人:toYDelta =0%P
    机器人:时间=1000
    机器人:fillAfter =真/>
 

您可以尝试用%值。

3.implement这在code这样的:

  translateAnim = AnimationUtils.loadAnimation(getApplicationContext()
            R.anim.translate_anim);
imageView.startAnimation(translateAnim);
 

希望这么多线索的就足够了!

PS:你可以尝试使用 fillAfter true或false,这样你可以了解他们的效果更佳。

Hi I have stuck with the problem of creating a splash screen where the image is placed in center_vertical|center horizontal.how to translater over to center_horizontal|top in android.can any one please guide me how to do it.

解决方案

Use animations to do this, for more information about animating views, you could refer to this link and also this

What you are actually looking for in translating a view from the center to the top of the screen, you could use translation animation using the xml.

1.Create a folder anim in the res folder 2.Add a resource file that describes your translation effect like :

<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:fromXDelta="50%p" android:fromYDelta="50%p" 
    android:toXDelta="50%p" android:toYDelta="0%p" 
    android:duration="1000" 
    android:fillAfter="true" />

You could experiment with the % values.

3.implement this in code like :

translateAnim= AnimationUtils.loadAnimation(getApplicationContext(),
            R.anim.translate_anim);
imageView.startAnimation(translateAnim);

Hope this much of clue suffices!

P.S: You could experiment with fillAfter true or false, so that you could understand their effects better.

这篇关于图片从中心到顶部的Andr​​oid翻译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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