Cordova / PhoneGap 9-patch闪屏 [英] Cordova/PhoneGap 9-patch splash screen

查看:193
本文介绍了Cordova / PhoneGap 9-patch闪屏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个9贴图图片( splash.9.png )我想用作我的Cordova(3.4.0)应用程序初始屏幕。如果我从Eclipse运行(Cordova)Android项目,一切都是应该的,即启动屏幕出现,只有可拉伸区域拉伸。但是,如果我使用命令行界面运行应用程序,整个启动屏幕被拉伸/变形,就像Cordova没有看到它作为一个9补丁图像,但作为一个普通的.png。我在config.xml中指定了以下内容:

I have a 9-patch image (splash.9.png) I'd like to use as my Cordova (3.4.0) app splash screen. If I run the (Cordova) Android project from Eclipse, everything is as it's supposed to be, i.e. the splash screen appears and only the stretchable areas are stretched. However, if I run the app using the command line interface, the entire splash screen is stretched/deformed, as if Cordova doesn't see it as a 9-patch image, but as a regular .png. I have the following specified in my config.xml:

<preference name="SplashScreen" value="splash" />
<preference name="SplashScreenDelay" value="5000" />

是否还需要设置其他内容?任何其他线索?提前感谢!

Is there anything else that needs to be set? Any other clues? Thanks in advance!

推荐答案

确定,答案是与9patch图像的弹性区域有关的一切。我通过ping github问题找到了答案。

OK, the answer has EVERYTHING to do with the stretchy areas of your 9patch image. I found the answer by pinging the github question. A user sent me to another discussion where someone had cracked it.

主要的问题是,大多数9patch教程解释如何拉伸按钮,但没有详细说明如何使图像居中。

The main issue is that most 9patch tutorials explain how to stretch buttons, but none detail how to center an image.

在讨论过程中查找绿色/蓝色/红色图片。

Look for the green/blue/red image a little more than half way through the discussion.

http://community.phonegap.com/nitobi/topics/stretched_9_p​​atch_splash_screens_android

返回副本:
http://web.archive.org/web/20160405060404/http://community.phonegap.com/nitobi/topics/stretched_9_p​​atch_splash_screens_android

我的关键是看边缘。这真的很难看到(至少对我来说),但你几乎不能弄清楚沿着边缘的黑色痕迹,定义了弹性的区域。顶部有2个小区域(在绿色),左侧有2个小(在绿色),底部有一个长(在蓝色),右侧有一个长(在蓝色)。

The key for me was to look at the edges. It's really hard to see (for me at least), but you can barely make out the black marks along the edge that define the stretchy areas. top has 2 small areas (on the green), left has 2 small (on the green), bottom has one long (on the blue), right has one long (on the blue).

此外,提供了一些XML,以允许在垂直和水平方向使用单个图像。

Additionally, some XML is provided to allow use of a single image in both vertical and horizontal orientations.

因此,我发现这一个图像硬的,因为它是看到的线)一个更好的指示,如何9patch工作比所有的教程我看过。

Consequently, I find this one image (as hard as it is to see the lines) a better instruction on how 9patch works than all of the tutorials I've watched.

这篇关于Cordova / PhoneGap 9-patch闪屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆