在LinearLayout Android上创建无限滚动背景

时间:2014-07-04 12:20:29

标签: android animation background

我想在我的背景中获得滚动效果,例如http://dev.bradsknutson.com/demos/css-background-animation/

我的LinearLayout在屏幕上匹配,在-x和-y上重复了图案背景,但我不知道如何垂直滚动。

1 个答案:

答案 0 :(得分:1)

在XML中使用相对布局。创建自定义视图。将自定义视图添加到相对布局。在顶部添加线性布局。

在自定义视图中,设置一个线程来处理渲染,使用deltatime在偏移处将背景位图绘制到画布,确保平铺以填补所有间隙。

这里有一些链接可以帮助您入门。

http://android-coding.blogspot.com/2011/05/drawing-on-surfaceview.html

http://www.anddev.org/novice-tutorials-f8/simple-surfaceview-example-t2174100.html

Android draw using SurfaceView and Thread

相关问题