zoukankan      html  css  js  c++  java
  • ActionBar更改背景颜色(主题)

    1.默认是黑色的背景,

    2.更改主题theme为Theme.AppCompat.Light即可,清单文件主题如下:

        <application
            android:name="com.itheima.googleplay.global.GooglePlayApplication"
            android:allowBackup="true"
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name"
            android:theme="@style/Theme.AppCompat.Light" >
            <activity
                android:name="com.itheima.googleplay.ui.activity.MainActivity"
                android:label="@string/app_name" >
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
    
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
            <activity android:name="com.itheima.googleplay.ui.activity.HomeDetailActivity" >
            </activity>
        </application>

    也可以单独更改某个activity的theme,清单文件:

        <application
            android:name="com.itheima.googleplay.global.GooglePlayApplication"
            android:allowBackup="true"
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name"
             >
            <activity
                android:name="com.itheima.googleplay.ui.activity.MainActivity"
                android:label="@string/app_name"
                android:theme="@style/Theme.AppCompat.Light" >
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
    
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
            <activity android:name="com.itheima.googleplay.ui.activity.HomeDetailActivity" >
            </activity>
        </application>

    效果如下图:

  • 相关阅读:
    构建之法阅读笔记03
    构建之法阅读笔记01
    构建之法阅读笔记02
    周总结06
    《大道至简》第一章伪代码
    《大道至简》观后感
    【leetcode】Valid Number
    【leetcode】Maximal Rectangle
    【Unity3D】Invoke,InvokeRepeating ,Coroutine 延迟调用,周期性调用
    【leetcode】Scramble String
  • 原文地址:https://www.cnblogs.com/johnsonwei/p/5653956.html
Copyright © 2011-2022 走看看