Android换色、主题和样式
1.Material换色思路,类似于BiliBili客户端换色:
1)首先在attr.xml文件中定义好需要使用到的样式,比如colorPrimaryLight、buttonBgColor等等,类似于这样
2)然后在style.xml中定义这些样式的具体内容,例如:
3)在布局文件中使用?attr/xxxx引用这些自定义的可变属性,(?android:attr/xxxx是引用android默认定义的可变属性,例如colorPrimary等)
4)Activity切换动画
2.AttributeSet,TypedArray-->http://blog.csdn.net/bingospunky/article/details/39890053
3.关于View自定义属性以及系统的View属性
1)attrs.xml文件中,<declare-styleablename="ABC">标签中定义的属性对应R文件中的R.styleable.ABC,是一个数组,里面的值对应着R文件中与<declare-styleable name="ABC">中的<attr>标签同名的值,可以在Context.obtainStyledAttributes(AttributeSet set, int[] attrs );方法中获取需要的TypedArray(属性集合),具体对应关系如下