Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to import .XML code style into Android Studio

I'm using Android Studio on OS X, and want to import intellij-java-google-style.xml for my code format.

But I can't find import at Preferences -> Project Settings -> Code Style -> Manage only Save as, Delete, Copy to project, and Close there.

like image 329
AngryYogurt Avatar asked May 20 '14 02:05

AngryYogurt


People also ask

How to import XML file in Android Studio?

Start Android Studio and open the project you'd like to add the module to. From the Android Studio menu click File > New > Import Module. Select the Eclipse ADT project folder with the AndroidManifest. xml file and click Ok.

Where is the XML file in Android Studio?

xml extension, in your Android project's res/layout/ directory, so it will properly compile. More information about the syntax for a layout XML file is available in the Layout Resources document.

How do I import a style file into IntelliJ?

Press Ctrl+Alt+S to open the IDE settings and select Editor | Code Style. and select Import Scheme. Then select the necessary format. In the dialog that opens, select the file with the settings and click Open.


2 Answers

Copy intellij-java-google-style.xml into the directory $HOME/Library/Preferences/IdeaIC14/codestyles/.

like image 159
passerby4j Avatar answered Sep 29 '22 03:09

passerby4j


I am using Android Studio 1.2 on Ubuntu 12.04 and in my case I have an .AndroidStudio1.2 folder in my home directory. In this folder there is a config folder. What I did was the following:

  1. I created a new folder called codestyles in the config folder.
  2. copied my style xml (in my case named AndroidStyle.xml) into the codestyles folder (.AndroidStudio1.2/config/codestyles/AndroidStyle.xml)
  3. Went into File>Settings>Editor>Code Style
  4. Chose the AndroidStyle among the listed Schemas.

NOTE: Android Studio does not give you an option to import the xml file. And before you add the file to the codestyles folder there is NO indication that you can change the Schema to your own in any way. But after you have added the file the added schema will be shown among the other schemas.

NOTE 2: In other Operating systems this folder is located elsewhere. For more info on configuration folders see here: http://tools.android.com/tech-docs/configuration

like image 28
blackwabi Avatar answered Sep 29 '22 03:09

blackwabi