当我们滑动主屏幕时,Android 壁纸也会左右滑动

发布于 2024-12-24 23:38:03 字数 193 浏览 5 评论 0原文

我想为 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

逆夏时光 2024-12-31 23:38:03

您可能想要使用具有可绘制功能的画布,然后检测用户的滑动并在后台为其设置动画。默认的 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文