Android 如何了解用户正在查看哪个主屏幕?
我想了解 Android 操作系统如何确定用户当前正在查看哪个主屏幕,并根据用户在设备触摸屏上向左或向右滑动的情况在该屏幕上呈现相应的图标和小部件。
操作系统必须保存屏幕的状态和 ID 或与屏幕上放置的对象相关的内容,以便在每次屏幕可见时检索状态。
根据我的研究,我了解到 Android 操作系统将设备上的所有 7-8 个主屏幕视为一台主机。
另外,我的问题可能看起来很模糊,但我问的原因是因为 Android 设备上的应用程序小部件不仅在手机唤醒时更新,而且仅在应用程序小部件本身可见时更新,这似乎是合理的。我知道 Google 拒绝了许多其他人的增强请求,但我认为这还不够好。链接此处。
这就是为什么我试图尝试用 Android 了解的主屏幕状态来为我的应用程序理解并实现它。
非常感谢任何帮助或见解。另外,那里的专家也让我知道您是否认为这甚至可以为一次性应用程序实现?
I wanted to understand how does the Android OS figure out which home screen the user is viewing currently and render the appropriate icons and widgets on that screen based on the user's left or right swipe on the touch screen of the device.
The OS must save a state of the screen and IDs or something relative to the objects placed on the screen to retrieve the state each time the screen becomes visible.
From my research I understand that Android OS treats all the 7-8 homescreens on devices as one single host.
Also my question might seem vague, but the reason why I am asking is because it seems reasonable that app widgets on android devices, update not only when the phone is awake but also only when the app widget itself is visible. I know that Google has declined the enhancement request by many others but I don't think that is good enough. Link here.
That is the reason why I am trying to give it a shot to understand and implement it for my app with whatever Android knows about the state of the home screens.
Any help or insight is much appreciated. Also the experts out there let me know if you think this can be even implemented for one off apps at all?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,正如您发布的链接明确指出的那样,没有办法知道。
此外,如果您考虑到“Home”只是一个像所有其他应用程序一样的应用程序,那么为此拥有一个统一的 API 就更没有意义了。很多人使用 Launcher Pro 或类似的应用程序,但它们可能无法实现它。
Well, as the link you posted clearly states, there's no way to know.
Also, if you consider the fact that "Home" is just an application like all the others, it makes even less sense to have a unified API for that. A lot of people use Launcher Pro or similar applications, which would probably not implement it.