美文网首页
设置activity的主题theme

设置activity的主题theme

作者: YuQiao0303 | 来源:发表于2019-05-27 16:50 被阅读0次

    创建于2019-05-27

    1. 在styles中用一对<style>标签写一种style

    例如默认的:

    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    </style>
    

    2. 在manifest中指定

    <activity
    android:name=".FruitActivity"
    android:theme="@style/FruitActivityTheme">
    </activity>
    

    3.如果需要考虑版本兼容:

    res目录下新建一个values-v21目录,在里面单独写:

    <resources>
    <style name="FruitActivityTheme" parent="AppTheme">
    <item name="android:statusBarColor">@android:color/transparent</item>
    </style>
    </resources>
    

    相关文章

      网友评论

          本文标题:设置activity的主题theme

          本文链接:https://www.haomeiwen.com/subject/qeohtctx.html