Rudy
Rudy

Reputation: 1

Shortcut for "Collapse empty tag" in Android Studio

What is the shortcut for "Collapse empty tag" in Android Studio or how could set it in keymap?

<element></element>

Convert to

<element />

If I press "Alt + Enter" shows me that option, but I would like to access this option directly

image

:(

P.S. I'm sorry for my English.

Upvotes: 0

Views: 1284

Answers (2)

ccpizza
ccpizza

Reputation: 31696

If you have a tag like:

<element></element>

and want to convert it to

<element/>

then the simplest way is to type a slash / within the opening element tag, i.e.

<element/></element>
       ^^
      ↑↑↑ type '/'

The IDE will automatically remove the closing </element> which results in:

<element/>

Upvotes: 1

yole
yole

Reputation: 97178

As of version 2016.2, there is no support in IntelliJ IDEA for assigning shortcuts to individual intention actions directly. The Alt-Enter popup is the only way to access this action from the keyboard.

Upvotes: 0

Related Questions