我正试图在Android上的画布对象上画一个九补丁。奇怪的是,尽管我使用draw9patch工具生成了我的九个补丁,但NinePatch的构造函数需要一个额外的字节数组来构造九个补丁。
为什么这不简单呢?什么是“块”?如果这是你自己做的,你是怎么做的?
感谢您的帮助。
发布于 2010-01-25 00:37:11
你可以很容易地做到这一点:
// Load the image as a NinePatch drawable
NinePatchDrawable npd = (NinePatchDrawable)Resources.getDrawable(R.drawable.my_nine_patch);
// Set its bound where you need
Rect npdBounds = new Rect(...);
npd.setBounds(npbBounds);
// Finally draw on the canvas
npd.draw(canvas);https://stackoverflow.com/questions/2127438
复制相似问题