最后
由于题目很多整理答案的工作量太大,所以仅限于提供知识点,详细的很多问题和参考答案我都整理成了 PDF文件
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
这是个基础主题,点进去可以发现:AppTheme的样式继承自上面的AppBaseTheme。而AppBaseTheme又继承自系统的一个样式Theme.Light,打开Android系统源代码找到Theme.xml文件中的Theme.Light如下:`
@drawable/screen_background_light
@android:color/background_light
@color/bright_foreground_light
@android:color/bright_foreground_light_inverse
@android:color/primary_text_light
@android:color/secondary_text_light
@android:color/tertiary_text_light
@android:color/primary_text_dark
@android:color/secondary_text_dark
@android:color/tertiary_text_dark
@android:color/primary_text_light_disable_only
@android:color/primary_text_dark_disable_only
@android:color/primary_text_light_nodisable
@android:color/secondary_text_light_nodisable
@android:color/primary_text_dark_nodisable
@android:color/secondary_text_dark_nodisable
@android:color/hint_foreground_light
@android:color/hint_foreground_dark
@android:style/Widget.PopupWindow
@android:drawable/indicator_check_mark_light
@android:drawable/indicator_check_mark_dark
@android:style/Widget.GestureOverlayView.White
@android:style/Widget.ExpandableListView.White
@android:style/Widget.ListView.White
@drawable/divider_horizontal_bright
@android:style/Widget.TextView.ListSeparator.White
@android:style/Widget.ProgressBar.Inverse
@android:style/Widget.ProgressBar.Small.Inverse
@android:style/Widget.ProgressBar.Large.Inverse
@android:style/Widget.ProgressBar
@android:style/Widget.ProgressBar.Small
@android:style/Widget.ProgressBar.Large
`
可以看出,主题都是通过定义各个控件的样式实现,指向其他的资源文件。
我们可以通过继承另一个主题自定义主题样式。
三、自定义主题样式
在values下新建一个themes文件夹,里面自定义各种主题。
如下例所示: