当我们滑动主屏幕时,Android 壁纸也会左右滑动
我想为 Android 开发一个新的主屏幕应用程序。我在我的 android 2.3.3 设备中看到默认主屏幕,当我左右滑动主屏幕时,背景壁纸也会左右滑动。那是什么观点?如何在应用程序中获得相同的效果?
是ViewPager
吗?我检查了 ViewPager
类,但没有找到其中所有视图的任何通用背景图像。
I want to develop a new home screen application for android. I saw the default home screen in my android 2.3.3 device, when ever I swipe the home screen left and right, the background wallpaper also sliding left and right. What is that view? How to get the same effect in an app?
Is it ViewPager
? I checked the ViewPager
class, but I didn't found any common background image for all views in that.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能想要使用具有可绘制功能的画布,然后检测用户的滑动并在后台为其设置动画。默认的 Android 背景很可能也是这样做的。您不会绘制视图中看不见的部分。
http://developer.android.com/guide/topics/graphics/2d -graphics.html
我建议先学习他们的月球着陆器教程来学习如何使用画布。
您将把画布作为应用程序的背景,然后将其他 ui 元素放在它上面,除非您将 ui 制作为基于画布内部。
You probably want to use a canvas with a draw-able, then detect the users swiping and animate it in the background. It is likely that the default android backgrounds are doing the same. You wont be drawing the unseen portions of the view.
http://developer.android.com/guide/topics/graphics/2d-graphics.html
I suggest doing their lunar lander tutorial to learn how to use the canvas first.
You will make a canvas the background to your app and then lay your other ui elements on top of it unless you make the ui based inside the canvas.