用 9patch 只拉伸一个轴

stretching only one axis with 9patch

所以我有一些图片我只想通过沿着一个轴的九个补丁功能拉伸,就像这样:

如您所见,两侧没有太多空间,所以我不能沿着 x 轴拉伸而不引起注意。相反,我以编程方式将宽度设置为适当的大小(使用此纵向版本)并使用沿 y 轴的指示区域以适应屏幕。

问题是我在构建时一直收到此日志输出。

AAPT out(164205) : No Delegate set : lost message:Done AAPT out(8577269) : No Delegate set : lost message:Done AAPT err(164205): ERROR: 9-patch image C:\Users\Brandon Thompson\AndroidStudioProjects\TilePuzzler\app\src\main\res\drawable\star_trek_federation_emblem_land9patch.9.png malformed. AAPT out(24044720) : No Delegate set : lost message:Done AAPT err(164205): No marked region found along edge. AAPT err(8577269): ERROR: 9-patch image C:\Users\Brandon Thompson\AndroidStudioProjects\TilePuzzler\app\src\main\res\drawable\star_wars_imperial_emblem_port9patch.9.png malformed. AAPT err(164205): Found along left edge. AAPT err(24044720): ERROR: 9-patch image C:\Users\Brandon Thompson\AndroidStudioProjects\TilePuzzler\app\src\main\res\drawable\star_trek_federation_emblem_port9patch.9.png malformed. AAPT err(8577269): No marked region found along edge. AAPT err(24044720): No marked region found along edge. AAPT err(8577269): Found along top edge. AAPT err(24044720): Found along top edge. AAPT out(22973825) : No Delegate set : lost message:Done AAPT err(22973825): ERROR: 9-patch image C:\Users\Brandon Thompson\AndroidStudioProjects\TilePuzzler\app\src\main\res\drawable\star_wars_imperial_emblem_land9patch.9.png malformed. AAPT err(22973825): No marked region found along edge. AAPT err(22973825): Found along left edge. Error:Execution failed for task ':app:mergeDebugResources'. Crunching Cruncher star_wars_imperial_emblem_port9patch.9.png failed, see logs

这似乎表明我必须在 x 轴上指定我的一些不可用区域,但我的印象是您可以将其设置为仅拉伸您想要的区域通缉。那个印象是错误的还是我遗漏了其他东西?是否可以简单地指定整个 x 轴以确保均匀拉伸?谢谢

事实证明,9patch 图像坚持在左侧和顶部边缘有一些黑色标记。通过沿着整条边画一条线,我不想分段拉伸,我确保了均匀展开。