skip to Main Content

I was using tab(size 6) for indention for flutter code in android studio.
After updating Android Studio to Arctic Fox 2020.3.1 code indention resets to 2 space tab.
I cant find option to change it.

Is it possible to use tab indention of size 6 ?

I am also considering using VSCode.

2

Answers


  1. Know it’s been a bit on this, but you can change the tab — just know they REALLY REALLY don’t want you to do it.

    You don’t mention the OS and I’m currently on Windows. On Windows, you edit the file located at %APPDATA%GoogleAndroidStudio2020.3codestylesDefault.xml and add the following snippet just before the closing </closeScheme> tag:

      <codeStyleSettings language="Dart">
        <indentOptions>
          <option name="INDENT_SIZE" value="6" />
          <option name="TAB_SIZE" value="6" />
        </indentOptions>
      </codeStyleSettings>  
    

    File location will vary for other operating systems. An answer to this question for an older version contains older locations on other operating systems: How to use 4-space wide tab character in Android Studio?.

    Those locations were identified in the above post as:

    • macOS: ~/Library/Preferences/ CONFIGURATION_FOLDER.
    • Linux: ~/.
      CONFIGURATION_FOLDER.

    Configuration folder is the AndroidStudio[xyz]/codestyles folder — AndroidStudio2020.3

    Login or Signup to reply.
  2. If you are an Android Developer and cannot leave Android Studio, since it’s your coding home, but can’t let go of flutter either.

    Changing tab size won’t work through Default.xml in codestyles.

    Use a different theme: Visual Studio 2019 Dark Theme (this auto adjusts indentation and makes code look exactly as of Visual Studio Code). To install theme – plugins -> search "Visual Studio 2019 Dark Theme"

    OR

    Use a different font: I prefer

    Font : "Droid Sans Mono Slashed" or "Monospaced" (You can use any that works for spacing)

    Font size: 18 , Line Height 1.4 // For 14 inch screens

    Font size: 14 , Line Height 1.2 // For 15.6 inch screens or larger

    enter image description here

    OR

    A combination of above looks beautiful.

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search