简体   繁体   English

在Android Studio中将png图像转换为9个补丁

[英]Convert png images to 9 patch in Android Studio

In android studio,you can edit 9 patches directly from with the IDE. 在android studio中,您可以直接使用IDE编辑9个补丁。 But is it also possible to convert an png image to 9-patch using the IDE? 但是也可以使用IDE将png图像转换为9-patch? (similar to the android 9-patch tool provided by the SDK). (类似于SDK提供的android 9-patch工具)。

Well I don't think there is any tool in Android Studio but you can do this by Android Asset Studio 我不认为Android Studio有任何工具,但您可以通过Android Asset Studio执行此操作

Android Asset Studio Simple Nine-patch Generator Android资产工作室简单九补丁生成器

This is a very handy tool to create simple 9 patch images for all dpi with a clean user interface. 这是一个非常方便的工具,可以使用干净的用户界面为所有dpi创建简单的9 patch图像。

如果您将资源从*.png重命名为*.9.png那么在Android Studio中您可以使用9补丁 (随Android SDK提供的工具)对其进行编辑。

Android Studio now has this option available by right-clicking on the image file in your res folder, then selecting Create 9-Patch file . Android Studio现在可以通过右键单击res文件夹中的图像文件,然后选择Create 9-Patch file来使用此选项。 You can then open the newly created 9-patch file and start editing! 然后,您可以打开新创建的9补丁文件并开始编辑!

Update: Android Studio now has a feature that can be used to generate 9patch images. 更新:Android Studio现在具有可用于生成9patch图像的功能。 To do this navigate to /home/android-studio/data/sdk/tools on your terminal and run draw9patch . 要执行此操作,请导航到终端上的/home/android-studio/data/sdk/tools并运行draw9patch

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM