获取的主屏幕数量的Android? [英] Get number of Home screens in Android?
问题描述
我在做一个动态壁纸为Android,我希望它滚动的用户滚动主屏幕。我能做到这一点,但在某些手机上,用户可以选择主屏幕的数量。反正是有让主屏幕的数量?
I'm making a Live wallpaper for Android, and I want it scroll as user scroll the home screen. I can do that, but on some phones, user can choose the number of home screen. Is there anyway to get the number of home screen?
感谢。
推荐答案
其实是有办法知道的主屏幕的数量。在onOffsetsChanged调用提供给该porpouse参数:浮动xOffset和浮动xOffsetStep
There is actually a way to know the number of home screens. The 'onOffsetsChanged' call provides to arguments for that porpouse: float xOffset and float xOffsetStep.
xOffset从0变为1和xOffsetStep重新presents步长为每个家庭卵石。因此,如果您配置您的主屏幕,6'桌面'xOffsetStep是0.2。
xOffset goes from 0 to 1 and xOffsetStep represents the step size for each home scree. So if you configure your home screen with 6 'desktops' xOffsetStep would be 0.2.
因此,最终的检查方法屏幕数必须在调用完成(默认情况下它是前人的精力总是1),则:(1 / xOffsetStep)+ 1
So the final way to check the number of screens must be done in that call (by default it sould be always 1) and then: (1/xOffsetStep) + 1.
希望它能帮助!
这篇关于获取的主屏幕数量的Android?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!