Android的 - 在环路背景图像动画 [英] Android - Background Image Animation in Loop

查看:100
本文介绍了Android的 - 在环路背景图像动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图动画图像(作为背景图片,但它其实并不重要),以这样的方式,从左至右,但以循环方式,它会移动。
例如,如果图像尺寸是完全一样的视图尺寸,一旦象素的最右列超出的右边缘,它会出现在视图的最左侧。

I'm trying to animate an image (used as background image but it doesn't really matter) in such a way that it will move from left to right but in a cyclic way. For example, if the image size is exactly as the view size, once the most right column of pixels exceeded the right edge, it will appear on the most left side of the view.

我想到这样做,但所有这些听起来太复杂,我的几个方面,我相信还有一个更芯的方式来做到这一点。

I've thought of several ways of doing it but all of them sounds too complicated to me and I'm sure there is a more "core" way to do that.

谢谢,
利奥尔。

Thanks, Lior.

推荐答案

你能使用 canvas.drawBitmap(sourceRectangle,outputRectangle,空)从条形切割的一部分位图的背景?这是用于动画的位图的相似方法,但你直到它击中背景带的边缘一个像素添加到sourceRectangle的左侧和右侧的值。

Could you use canvas.drawBitmap(sourceRectangle,outputRectangle,null) to cut a part from a strip bitmap background? This is a similar method that is used to animate a bitmap, but you would add one pixel to the sourceRectangle's left and right values until it hits the edge of the background strip.

这篇关于Android的 - 在环路背景图像动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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