Android XML是否可以使用具有自定义属性的工具名称空间? [英] Android XML Is there a way to use the tool namespace with custom attributes?
本文介绍了Android XML是否可以使用具有自定义属性的工具名称空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经创建了带有属性的自定义视图.有没有一种方法可以在Android Studio中将这些属性与android工具一起使用?
I've created a custom view with attributes. Is there a way to use those attributes with android tools in Android studio?
例如:
<MyOwnCoolView
android:layout_width="96dp"
android:layout_height="96dp"
android:padding="3dp"
tools:dividerAngle="2"/>
attr文件在哪里:
Where the attr file is :
<resources>
<declare-styleable name="MyOwnCoolView">
<attr name="dividerAngle" format="float"/>
</declare-styleable>
推荐答案
我的观点是你做不到.
有一个正式的页面,虽然非常很旧,但页面此处引用:
There's an official, though very old, page here that quotes:
Designtime属性只能用于框架资源,不能用于框架资源自定义属性.
Designtime attributes can only be used for framework resources, not custom attributes at this point.
这篇关于Android XML是否可以使用具有自定义属性的工具名称空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文