开发者

Get number of homescreens without calling onoffsetschanged (for wallpaper)?

I'm doing a live wallpaper. However, what is initially shown depends on the number of home screens. While onOffsetsChanged() allows you to calculate the number of home screens, it gets called only if the user scrolls the homescreen.

So is there a way to get the current xStep and xOffSet without calling onOffSetsChanged()?

Edit: I may not need to know that per se. Here's what I'm doing: I'm basically drawing a portion of the bitmap. The portion shown depends on the current homescreen.

Edit 2: so to explain what I'm trying to do---I'm basically trying to mimick the scrolling wallpaper effect but with a video. The point is that the portion shown depends on the current homescreen. Here's the problem: So the user selects the wallpaper. OnSurfaceCreated() is called, followed by onSurfaceChanged(). However, onOffSetsChanged() is never called until the user tries to scroll the homescreens. That's the problem. You don't know wh开发者_JS百科at part of the bitmap/video to display until the user scrolls the screen. (So Josh's suggestion doesn't work. The part of the video that's displayed may be wrong---until the user scrolls the screen and we get the correct onOffSetsChanged() values.)


Your edit doesn't really explain why you need to know how many screens there are. You can draw the center portion of your bitmap initially, then when xOffset changes to something like 0, draw the leftmost portion of your bitmap. What's the issue?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜