Phonegap 初始屏幕方向
当为phonegap应用程序设置启动屏幕时,图片会拉伸到整个屏幕,即使我制作了一张徽标位于中心的大图片。理想情况下,我希望图片位于黑色或白色背景的中心。如何配置闪屏的行为?
When setting the splashscreen for a phonegap application, the picture gets stretched across the whole screen, even when i make a big picture with the logo in the center. Ideally I want the picture just sit in the center with a black or white background. How can I configure the behaviour of the splashscreen?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
有一个更好的解决方案:只需将以下splash.xml放入res/drawable中(修改android:src属性)并在setIntegerProperty()调用中更改对R.drawable.splash的引用。
请参阅我的博客有关设置的更详细说明。
There is a better solution available: Simply place the following splash.xml in res/drawable (modify the android:src attribute) and change the reference to R.drawable.splash, in the setIntegerProperty() call.
Please see my Blog for a more detailed description of the set-up.
我只是根据启动时的当前方向设置启动屏幕。不完美,但有效。您可以更进一步,方向上的广告会改变相同的效果,但有人在启动屏幕启动期间改变方向的机会很小。
I just set the splash screen based on the current orientation on startup. Not perfect, but works. You could go further and ad on orientation change the same effect, but the chances of someone changing orientation during splash screen startup is slim.
这是一个解决方案,但它有缺陷
,将您的splash.png放在各种可绘制文件夹中,
此方法的已知问题是如果加载后方向发生变化,它不会更新背景...(这对于phonegap 1.10来说是正确的)
This is a solution but it has flaws
put your splash.png in the various drawable folders
known issue with this method is if the orientation changes after load it doesn't update the background... (this is true for phonegap 1.10)