怎么将自定义style添加到project theme

2025-05-17 19:10:09
推荐回答(1个)
回答(1):

style是定义了决定view或者窗口外观与格式的一组属性的集合~可以想象成一个游戏里的npc角色,当需要创建很多次时(小怪),可以把相同的属性都打包放在一起(血量、攻击力等),创建时直接加上即可,就不需要重复定义这些属性(听起来有点像java里面的superclass==)
style定义的xml放在哪里?
The name of the XML file is arbitrary, but it must use the .xml extension and be saved in the res/values/ folder.
名字随意,必须.xml后缀,放在res/values/目录下。
style和theme针对谁?
A theme is a style applied to an entire Activity or application, rather than an individual View
A style such as the one defined above can be applied as a style for a single View or as a theme for an entire Activity or application.
theme针对单独的activity或者整个app,style针对单个的view不过theme也可以使用style。