Changing background colour and theme colours in Android Studio



Change the background colour of your app

  1. Create a new project, selecting the full screen app option. 
  2. Locate the <AppName>/app/src/main/res/layout/activity_fullscreen.xml file. 
  3. Select the "Text" tab at the bottom of the file window (if not already selected)
  4. Inside FrameLayout change the background colour:
android:background="#FFF500B8"


Changing the theme colours of your app

  1. Change the status bar and slide over top menu bar colours using the Theme Editor (Tools > Android > Theme Editor).
  2. Either change the default theme colours or select a new theme
  3. Note that where a warning symbol appears this most likely means that there is a possible lack of contrast between elements and that you should revise your colour choices
  4. If you have selected (and/or amended) a new theme, return to the activity_fullscreen.xml file and select the theme from the top bar of the layout preview screen.

Notes

The theme for a project is defined in the <AppName>/app/src/main/AndroidManifest.xml file and this is linked to the <AppName>/app/src/main/res/values/styles.xml file. Ctrl click on the defined styles (in OS X) and select Go To > Declaration (or hold down cmd + B and click on the style name) to link through to the <AppName>/app/src/main/res/values/colors.xml file where the hex values are given.


Endorse on Coderwall

Comments

Post a Comment