style和attr的 温习
来源:互联网 发布:手机ssh连接linux 编辑:程序博客网 时间:2024/06/13 22:25
android l引入了新的theme,so,你需要温习style
有这样一篇文章(所以,本文为 转载):http://www.cnblogs.com/angeldevil/p/3479431.html
之下为 总结:
attrs.xml
其中定义了,app中允许出现哪些属性
declare-styleable
声明了一些属性
形式:
<declare-styleable name="styleable1">
<attr name="attr1" format="" />
</declare-styleable>
系统会为我们生成:
R.styleable.styleable1(为int[]类型,而其ele为 styleable1所声明的属性)
R.styleable.styleable1_attr1(该属性 在 styleable 中的索引)
声明在 styleable中的属性 和 直接在attrs.xml中定义的属性 有什么区别:
当我们自定义了一个view,可能需要为该view设置一些属性,而这些属性从哪里来:往往来自styleable(和,系统已经预先定义的属性)
style
一些 属性和其值 的集合
属性的值类型:
string,int,color等
reference
引用了什么:一个style
属性的值的来源 和 优先级:
在layout.xml中,定义 view的myappns:attr1
在layout.xml中,定义 view的style
在view.java中,指定 defStyleAttr(而当前theme会指定 该styleattr引用了哪个style)
defStyleAttr 和 defStyleRes:
出现在:public TypedArray obtainStyledAttributes (AttributeSet set, int[] attrs, int defStyleAttr, int defStyleRes)
而你可以通过:tarray.getxxx(R.styleable.styleable1_attr1);获得属性值
在view.java中,指定 defStyleRes(起作用的情形:当defStyleAttr为0 或者 defStyleAttr不为0,但是defStyleAttr并没被指定引用)
在theme中指定属性值
- style和attr的 温习
- style[attr]和style.attr的问题
- attr和style相关的自定义
- Attr、Style和Theme
- 样式(style)和主体(theme)的回顾温习
- Android自定义attr和style
- Attr、Style和Theme详解
- 一些关于style和attr的使用问题
- 一些关于style和attr的使用问题
- d3中的selection.style和selection.attr的区别
- Android里面的Attr、Style和Theme 解析
- Android中的Attr、Style和Theme详解
- Android中 @和?区别以及?attr/**与@style/**等的区别
- Android中 @和?区别以及?attr/**与@style/**等的区别
- Android xml中 @和?区别,style和attr小结
- 安卓 style="?android:attr/progressBarStyleSmall"表示的含义
- 安卓 style="?android:attr/progressBarStyleSmall"表示的含义
- JAVA温习:wait和sleep的区别
- Android 应用在退出时弹出提示框
- LiuSY的隐私声明
- 程序设计学习方法
- 黑马程序员:交通灯管理系统
- android AQuery框架执行回调 AjaxCallback<?>
- style和attr的 温习
- Android中内容观察者的使用---- ContentObserver类详解 (转)
- 黑马程序员:Java高新技术
- 安装Linux Mint 17后要做的配置
- 黑马程序员:IO流
- ACE网站
- 设计模式第四讲:建造者模式
- 内部类 问题
- WebKit入门篇之cygwin的资源获取