我希望能够使用
tools:text="Text"
在 style.xml 文件中,这样就不会在我所有使用该样式的布局中复制 tools:text。
我已经试过了:
<item name="text">@string/text</item>
但是当存在时,编辑器不显示文本。
感谢您的帮助!
最佳答案
根据文档:https://developer.android.com/studio/write/tool-attributes.html#design-time_view_attributes
tools:
instead ofandroid:
Intended for:
<View>
Used by: Android Studio layout editor
不幸的是,这意味着您不能使用 tools:text
在 <style>
里面元素。
关于android - 如何在样式 xml 中包含工具命名空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48851616/