網(wǎng)站首頁 編程語言 正文
先來看一個(gè)自定義屬性重復(fù)的例子:
attrs.xml
<resources>
<declare-styleable name="View1">
<attr name="title_color" format="color" />
</declare-styleable>
<declare-styleable name="View2">
<attr name="title_color" format="color" />
</declare-styleable>
</resources>
這樣會報(bào)錯如下:Found item Attr/color_type more than one time
解決辦法也很簡單,把相同的屬性抽出來定義就可以。
<resources>
<attr name="title_color" format="color" />
<declare-styleable name="View1">
<attr name="title_color" />
</declare-styleable>
<declare-styleable name="View2">
<attr name="title_color" />
</declare-styleable>
</resources>
原文鏈接:https://blog.csdn.net/tianjf0514/article/details/125750217
相關(guān)推薦
- 2022-02-10 微信小程序this.triggerEvent(),父組件中使用子組件的事件
- 2022-08-01 Android開發(fā)之Flutter與webview通信橋梁實(shí)現(xiàn)_Android
- 2022-08-16 Python中集合的創(chuàng)建及常用函數(shù)的使用詳解_python
- 2022-10-10 pandas?修改列名的實(shí)現(xiàn)示例_python
- 2022-12-06 Android?Doze模式下Alarm定時(shí)任務(wù)實(shí)現(xiàn)流程詳解_Android
- 2022-10-06 C#?獲取本機(jī)IP地址(IPv4和IPv6)_C#教程
- 2022-06-07 進(jìn)行數(shù)據(jù)處理的6個(gè)?Python?代碼塊分享_python
- 2022-08-31 Python?selenium?find_element()示例詳解_python
- 最近更新
-
- window11 系統(tǒng)安裝 yarn
- 超詳細(xì)win安裝深度學(xué)習(xí)環(huán)境2025年最新版(
- Linux 中運(yùn)行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎(chǔ)操作-- 運(yùn)算符,流程控制 Flo
- 1. Int 和Integer 的區(qū)別,Jav
- spring @retryable不生效的一種
- Spring Security之認(rèn)證信息的處理
- Spring Security之認(rèn)證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權(quán)
- redisson分布式鎖中waittime的設(shè)
- maven:解決release錯誤:Artif
- restTemplate使用總結(jié)
- Spring Security之安全異常處理
- MybatisPlus優(yōu)雅實(shí)現(xiàn)加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務(wù)發(fā)現(xiàn)-Nac
- Spring Security之基于HttpR
- Redis 底層數(shù)據(jù)結(jié)構(gòu)-簡單動態(tài)字符串(SD
- arthas操作spring被代理目標(biāo)對象命令
- Spring中的單例模式應(yīng)用詳解
- 聊聊消息隊(duì)列,發(fā)送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠(yuǎn)程分支