如题所述
在style文件中定义属性我知道: 18.0sp @drawable/skin_color_button @drawable/common_btn_green 使用style我也知道: 但你说的在style中使用自定义属性我有点迷糊。style中不就是自定义的属性吗?
温馨提示:答案为网友推荐,仅供参考
第1个回答 2017-08-22
其实我们在style.xml中使用自定义属性的话,不需要写自定义控件的命名空间,我们只需要在style中使用命名控件的地方换成自定义控件的包名即可(注意:是包名,不带自定义控件的名字),如下:
<resources xmlns:android="" >
<style name="test" >
<item name="com.zhufuing:name_text">hello,world!</item>
</style>
</resources>
<resources xmlns:android="" >
<style name="test" >
<item name="com.zhufuing:name_text">hello,world!</item>
</style>
</resources>