Anyone with experience having the 9 patch editor in AS suddenly start using a black background for images? I have had no problems using it, now suddenly I can't make any edits. The image below should have a transparent background. If I try and drag the stretchable patches nothing changes, it keeps resetting itself, so to speak. Also this change happened in the same session.
I have the similar problem, right-click to select "Create 9-Patch file...", the transparent area become black. It only occur in some images after converted by ImageMagick.
Check the image details by pngcheck
tool:
xb@dnxb:/tmp$ pngcheck msg_box.png #original image
OK: msg_box.png (2251x967, 32-bit RGB+alpha, non-interlaced, 99.9%).
It becomes palette+trns after converted by ImageMagick:
xb@dnxb:/tmp$ convert msg_box.png -transparent white -trim msg_trim.png
xb@dnxb:/tmp$ pngcheck msg_trim.png
OK: msg_trim.png (394x311, 8-bit palette+trns, non-interlaced, 98.5%).
The solution is prefix the image with png32 to force it outputs RGBA:
xb@dnxb:/tmp$ convert msg_box.png -transparent white -trim png32:msg_trim.png
xb@dnxb:/tmp$ pngcheck msg_trim.png
OK: msg_trim.png (394x311, 32-bit RGB+alpha, non-interlaced, 99.4%).
xb@dnxb:/tmp$
Now when I paste this image in Android Studio and right-click to select "Create 9-Patch file...", then it able to keep transparent instead of black.
来源:https://stackoverflow.com/questions/25171838/9-patch-editor-android-studio-suddenly-black