开发者

Android wont let me compile NinePatch file - file.9.png

What is the extension for 9 patch files? xxxxx.9.png? Thats what is being explained here: http://developer.android.com/guide/topics/graphics/2d-graphics.html#nine-patch

"It must be saved with the extension .9.png, and saved into the res/drawable/ directory of your project. "

But when im trying to compile the project i get error - because of the file name! i 开发者_StackOverflow中文版cant hold 2 dots in the filename..

So how do i solve it?


In your SDK directory, there is a tool called "draw9patch"

/path/to/sdk/tools/draw9patch

You have to use that to create your Nine-patch images. You cannot just rename any image with the .9.png extension. When the image has been properly formatted with the tool, you will no longer get the compilation errors.

Read about how to use the tool here:

http://developer.android.com/guide/developing/tools/draw9patch.html


Yes, NinePatch files have the extension '.9.png'

Some filenames that have Java keywords will cause issues (e.g. try having a resource named private).

Other than that I suggest you clean your project.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜