我有一个可以构建和工作的项目,但我的图像(png)并不适应手机。
实际上,我有10张图片,我将它们放在所有可绘制的文件夹中: -drawable-hdpi有10张图片 -drawable-mdpi有10个SAMES图像(同名,相同大小,相同分辨率) - ... xhdpi,xxhdpi,xxxhdpi
相同1)我尝试使用SimpleAs-patch Generator,从AndroidAssetStudio这样:http://romannurik.github.io/AndroidAssetStudio/nine-patches.html
然后我运行我的应用程序,我收到了这个错误:
错误:9-patch image ../../IMAGE_1.png格式错误。帧像素必须是 固体或透明(非中间alphas)
2)然后我尝试回到原来的.png,并使用/ Android / Sdktools / draw9patch,并将.9.png生成在右侧文件夹中。
我收到了这个错误:
ERROR: 9-patch image ../../IMAGE_1.9.png malformed.
AAPT: No marked region found along edge.
AAPT: Found along top edge.
这是我的原始图片之一:
以及生成的版本:
答案 0 :(得分:2)
OK, this is your 9 patch.
There's a bad pixel on the bottom marker.
And this is how it will stretch, due to the markers you set.
This is my fixed version (note the top markers: 2 single pixels)
And this is how it nicely stretches (width only, because of the curved edges - You can add a transparent line on top and bottom to make it leave some "space", the left side markers would then have to be made 2 single pixels, one per each transparent line).