我正在尝试清理一个包含大量 9-patch 图像(50 个左右)的大型项目。我发现的一件事是,当一个 android 项目从 Eclipse 迁移到 Android Studio 时,系统会查看 9 个补丁镜像以确保它们符合标准。而且我遇到了很多 gradle 错误。
我见过的关于 9 补丁的最佳描述是 simple guide to nine patch.
Android Studio 包含一个 9 补丁编辑器工具。正是使用该工具将我带到了这里。该工具有一个按钮可以切换“显示坏补丁/隐藏坏补丁”。我在努力理解“坏补丁”的概念。
引用:Android document, describing the use of that button.
Show bad patches: Adds a red border around patch areas that may produce artifacts in the graphic when stretched. Visual coherence of your stretched image will be maintained if you eliminate all bad patches.
引用:Android Developer guide on 2d graphics. 该指南说“显示坏补丁”按钮......
raises warnings if the region you've defined for the stretchable area is at risk of producing drawing artifacts as a result of the pixel replication.
这是我正在查看的文件的屏幕截图:
所以这是交易。无论我做什么,我的图形上总是会出现一些坏补丁。您如何“清理”图像以避免损坏补丁?
为什么我的屏幕上显示那些红色框?我一直在玩图像和 1 像素边框,但不确定从这里去哪里。有人知道这里发生了什么吗? Nirvana.9.png 是什么样子的?
最佳答案
关于Android Studio,9 补丁和 "Show Bad Patches"按钮。它怎么知道?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28311523/