When we create a new Android project, Android Studio will give us an AppTheme by default, with the following content

<resources>

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

</resources>Copy the code

ColorPrimary, colorPrimaryDark, colorAccent Everyone should be very familiar with, respectively control the following interface color

Here are a few other color-related attributes that you might not normally use, but that can be used to make your interface more colorful and more effective. (Again, the following attributes apply to systems 5.0 and above)

ColorControlHighlight colorControlHighlight is used to control the ripple effect color of all clickable views, using button as an example in normal state


<item name="colorControlHighlight">@color/colorAccent</item>Copy the code



colorButtonNormal



normal







android:navigationBarColor






EditText

  • Unfocused – colorControlNormal
  • Focus – colorAccent
  • Cursor – colorAccent
  • The text color – android: textColorPrimary

RadioButton

  • Unselected – colorControlNormal
  • Selected – colorAccent

CheckBox

  • Box unchecked — colorControlNormal
  • The box checked – colorAccent

Toolbar

  • Background — Set android:background=”? attr/colorPrimary
  • Overflow icon – android: textColorPrimary
  • Navigation icon – android: textColorPrimary
  • The action ICONS – android: textColorPrimary
  • Overflow Menu Background — Android :colorBackground
  • Overflow text color — Android :textColorPrimary

ActionBar

  • Background – colorPrimary
  • The title color – android: textColorPrimary
  • Overflow icon – android: textColorPrimary
  • The up button, the android: textColorPrimary
  • The action ICONS – android: textColorPrimary
  • Overflow Menu Background — Android :colorBackground
  • Overflow text color — Android :textColorPrimary

Spinner

  • Indicator (not pressed) — colorControlNormal
  • Indicator (pressed) – colorAccent
  • Select entry text color — “Android :textColorPrimary

SwitchCompat

  • Thumb switch off — colorSwitchThumbNormal
  • Thumb switch on — colorAccent
  • Track overlay – colorAccent”