How to Surround Selected Codes with Quote or Brace in Android Studio

By default, when you highlight a word or a phrase and then press quote, the highlighted words are replaced by quotes. That’s how Android Studio works. There are 2 solutions to insert quotes or braces.

Table of Contents

Live template

Surround live template can be used to insert any symbols or characters to both sides of selected text. Braces surrounding can be called by default with the B abbreviation so there is no need to add a new template. Access Settings > Editor > Live Template and add a new template within the surrounding group for a quote. The template’s content should be “$SELECTION$”.

Then you can apply this template via the Live Template popup menu by pressing Ctrl+Alt+T or Ctrl+Alt+J.

Smart Keys

Using Smart Keys is simple and faster. Access Settings > Editor > General > Smart Keys and check “Surround selection on typing quote or brace”. Android Studio then auto insert quotes or brace when you type them when highlighting texts.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.