網(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>
這樣會(huì)報(bào)錯(cuò)如下:Found item Attr/color_type more than one time
解決辦法也很簡(jiǎn)單,把相同的屬性抽出來定義就可以。
<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-10-12 antd為Tree組件標(biāo)題附加操作按鈕功能_Redis
- 2022-11-23 Android開發(fā)Jetpack?Compose元素Modifier特性詳解_Android
- 2022-02-18 取一個(gè)數(shù)組中想要的值,放到一個(gè)新的對(duì)象里
- 2022-06-24 React如何使用refresh_token實(shí)現(xiàn)無感刷新頁面_React
- 2023-03-23 Rust應(yīng)用調(diào)用C語言動(dòng)態(tài)庫的操作方法_Rust語言
- 2022-07-04 C#字符串String及字符Char的相關(guān)方法_C#教程
- 2022-10-02 C#利用FileSystemWatcher實(shí)時(shí)監(jiān)控文件的增加,修改,重命名和刪除_C#教程
- 2022-05-01 docker鏡像與傳統(tǒng)vm虛擬機(jī)區(qū)別及分析_docker
- 最近更新
-
- window11 系統(tǒng)安裝 yarn
- 超詳細(xì)win安裝深度學(xué)習(xí)環(huán)境2025年最新版(
- Linux 中運(yùn)行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲(chǔ)小
- 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錯(cuò)誤: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)-簡(jiǎn)單動(dòng)態(tài)字符串(SD
- arthas操作spring被代理目標(biāo)對(duì)象命令
- Spring中的單例模式應(yīng)用詳解
- 聊聊消息隊(duì)列,發(fā)送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠(yuǎn)程分支