Importing the Official Android Code Style to Android Studio/IntelliJ
- Download
AndroidStyle.xml
from the Android platform_development repository.
a. You might think you can just click the link above and Save As…, but you’re wrong. Click the link, then choose the “Raw” display option.- Save it to
~/Library/Preferences/AndroidStudioBeta/codestyles.
Hidden files and folders will need to be visible to do this. To make hidden files and folders visible, follow the steps here: http://www.mikesel.info/show-hidden-files-mac-os-x-10-7-lion/- Restart Android Studio
- Navigate to Android Studio > Preferences
- Navigate to Code Style > Java
- From the Scheme drop-down, select the name of the imported code style
- Click OK
! A note on column width:
The Android code style sets the column width to 100, which is very limiting. Change this by going to Code Style > General, and changing the “Right margin (columns)” field to 200.
Thinking about a career in coding and development?