如何使用反向舍入在xml中创建drawable?

时间:2017-03-15 09:52:12

标签: android android-xml android-drawable

我需要在xml中创建下一个drawable:  enter image description here

我怎样才能做到这一点? 我只知道如何进行右上角舍入 - 但是右下角的反向舍入呢?

1 个答案:

答案 0 :(得分:0)

您应该使用九个补丁图像来执行此操作。

https://developer.android.com/studio/write/draw9patch.html

示例工具:
https://romannurik.github.io/AndroidAssetStudio/nine-patches.html#&sourceDensity=320&name=example

九个补丁是一个png图像,边框中有黑色像素,用于划分必须扩展的区域。格式为example.9.png.9.png是扩展名。

一个小教程,你可以找到其他人: https://www.youtube.com/watch?v=wLimJf-EIl8