如何在样式xml中包含工具命名空间

时间:2018-02-18 12:22:54

标签: android xml android-layout

我希望能够使用

tools:text="Text"

在style.xml文件中,这种方式不会复制工具:我所有布局中使用该样式的文本。

我已经尝试过了:

<item name="text">@string/text</item>

但是当存在时,编辑器不显示文本。

感谢您的帮助!

1 个答案:

答案 0 :(得分:5)

根据文件:https://developer.android.com/studio/write/tool-attributes.html#design-time_view_attributes

  

tools:代替android:

     

拟用于: <View>

     

使用者:Android Studio布局编辑器

不幸的是,这意味着您无法在tools:text元素中使用<style>