创建自定义绘制对象,并使用它以XML [英] Create a custom Drawable and use it in XML

查看:185
本文介绍了创建自定义绘制对象,并使用它以XML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我忙于创建 NinePatchDrawable 的那么复杂版本的瓷砖伸展它们的内板代替。

I am busy creating a less complicated version of NinePatchDrawable that tiles the inner panels instead of stretching them.

我可以实现实际的逻辑做渲染和这样的。

I can implement the actual logic to do the rendering and such.

不过,我找不到有关如何使用该绘制对象在XML文件中的文档。这可能吗?也就是说,我可以有一个<平铺九个补丁> ,或一些这样的,标签,我可以用它来定义资源

However, I can't find documentation about how to use this Drawable in the XML files. Is this possible? That is, can I have a <tileable-nine-patch>, or some such, tag I can use to define resources?

推荐答案

不幸的是,不可能使用在XML文件中的定制可绘制由于潜在的安全问题。请参见这里了谷歌论坛主题关于这个题目与罗曼盖伊的响应,之一的Andr​​oid开发者。

Unfortunately it is not possible to use custom drawables in XML files due to potential security issues. See here for a Google Groups thread about this very topic with a response from Romain Guy, one of the Android developers.

您仍可以使用,虽然它们在Java code。

You can still use them in your Java code though.

这篇关于创建自定义绘制对象,并使用它以XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆