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>

效果如下图:

 

posted @ 2016-07-08 16:53  达哥的博客  阅读(2787)  评论(0编辑  收藏  举报