由左到右的背景图片的运动 [英] Background image move from left to right

查看:285
本文介绍了由左到右的背景图片的运动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的应用程序。在登录界面有一个bcakground图像。我想移动从左到右此背景下image.how我可以做到这一点?

I am working on app. in which login screen have a bcakground image. I want to move left to right this background image.how can i do this.?

一个样本codeI有使用,但是这将移动图像和左布局balnk。我不希望它。

A sample code i have using but this will move the image and left the layout balnk. i dont want it.

    ImageView img_animation = (ImageView) findViewById(R.id.img_animation);

    TranslateAnimation animation = new TranslateAnimation(0.0f, 400.0f,
            0.0f, 0.0f);
    animation.setDuration(5000);
    animation.setRepeatCount(5);
    animation.setRepeatMode(2);
    animation.setFillAfter(true);
    img_animation.startAnimation(animation);

我只是想实现像这个应用程序的屏幕:

I just want to implement as like this application screen :

在检查该应用登录界面设备。登录界面有背景的图像。从这个图片左右移动。我怎样才能做到这一点process.please帮助我。

check this application login screen in device. login screen have an image in background. and this image move from left to right. How can i achieve this process.please assist me.

推荐答案

您可以尝试使用的矩阵

设置ImageView的以矩阵的scaleType。

set the scaleType of the ImageView to matrix.

<ImageView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scaleType="matrix" />

再转换成了ImageView的使用有点向右每毫秒的矩阵。

then translate the matrix used by the ImageView a little bit to the right every milliseconds.

Matrix matrix = new Matrix();
matrix.postTranslate(x, y);
img_animation.setImageMatrix(matrix);

这篇关于由左到右的背景图片的运动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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