One of the most useful methods for editing multiple lines of code or XML in Android Studio (or IntelliJ) is the multicursor feature. It allows you to edit multiple lines simultaneously. Here’s a quick cheat sheet with the most useful shortcuts for using multicursor effectively.
Multiple Carets
There are several ways to add and remove carets, depending on the situation.
With the mouse, use Shift + Alt + Click to add a caret, and Shift + Alt + Click on a caret to remove it. For faster selection of multiple carets, hold Alt and drag vertically to select a block or line.
With the keyboard, press Ctrl (Windows & Linux) / Alt (macOS) twice, then hold it while pressing the up or down arrow keys to add or remove carets. To remove all existing carets except the main one, press Esc.
Multiple Selections
There are several ways to select multiple occurrences of the same text.
You can create a new selection manually by pressing Ctrl + G (Windows & Linux) or Cmd + G (macOS) to find and select the next occurrence of the currently selected text. Alternatively, hold Shift + Alt and double-click the left mouse button.
If you want to select matching text, press Alt + J. To select all occurrences, speed up the process by using Shift + Ctrl + Alt + J (Windows & Linux) / Ctrl + Cmd + G (macOS).
Editing
Press Esc to cancel all selections except the main caret.
Resources
Here are some helpful links to learn more: