Customize Theme’s Colors

Posted on

Last illustration exhibit how to Apply Material Theme (with default color) to Activity. The video exhibit how to farther custom the subject colors.


Edit values/styles.xml to modify style of “AppTheme2”, adding diverse color defination.

<resources>      <!-- Base application theme. -->     <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">         <!-- Customize your subject here. -->         <item name="colorPrimary">@color/colorPrimary</item>         <item name="colorPrimaryDark">@color/colorPrimaryDark</item>         <item name="colorAccent">@color/colorAccent</item>     </style>      <style name="AppTheme2" parent="android:Theme.Material">         <item name="android:colorPrimary">@android:color/holo_orange_light</item>         <item name="android:colorPrimaryDark">@android:color/holo_orange_dark</item>         <item name="android:textColorPrimary">@android:color/holo_blue_bright</item>         <item name="android:windowBackground">@android:color/darker_gray</item>         <item name="android:navigationBarColor">@android:color/holo_green_dark</item>     </style>  </resources>  

Make certain “@style/AppTheme2” is used inwards AndroidManifest.xml.

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"     package="com.blogspot.android_er.androidmultiwindow">      <application         android:allowBackup="true"         android:icon="@mipmap/ic_launcher"         android:label="@string/app_name"         android:supportsRtl="true"         android:theme="@style/AppTheme2">         <activity android:name=".MainActivity">             <intent-filter>                 <action android:name="android.intent.action.MAIN" />                  <category android:name="android.intent.category.LAUNCHER" />             </intent-filter>         </activity>     </application>  </manifest> 

Reference:
– Using the Material Theme