MaterialDesign控制项目全局样式


为什么要用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":当前所有的文本颜色
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值