为什么要用appcompat项目,因为里面是谷歌精心准备的---解决android碎片化开发蛋疼的问题,让我们app编译出来在
各种高低版本之间、不同的厂商生产的ROM之间显示出来的效果UI控件等有一较一致的体验。
1.引入appcompat-v7项目(包括了android-support-v7-appcompat.jar和资源文件)
2.写自己的全局样式:
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
<item name="android:textColor">@color/mytextcolor</item>
<item name="colorPrimary">@color/colorPrimary_pink</item>
<item name="colorPrimaryDark">@color/colorPrimary_pinkDark</item>
<item name="android:windowBackground">@color/background</item>
<item name="colorAccent">@color/accent_material_dark</item>
<!-- 设置虚拟导航栏背景颜色 -->
<item name="android:navigationBarColor">@color/colorPrimary_pink</item>
</style>
colorPrimary:主色,
colorPrimaryDark:主色--深色,一般可以用于状态栏颜色、底部导航栏
colorAccent:(代表各个控件的基调颜色--CheckBox、RadioButton、ProgressBar等等)
"android:textColor":当前所有的文本颜色