Complete Guide to Android Studio Shortcuts

Complete Guide to Android Studio Shortcuts Tip:Click the aboveLinux CommunitySubscribe for free

Android Studio is an Android development tool developed by Google based on IntelliJ IDEA, similar to EcliPSe ADT. Android Studio provides integrated Android development tools for development and debugging, with Gradle-based build support.

Now a large number of developers are turning to Android Studio for development. To learn development more quickly, you need to learn to use shortcuts. Here is a summary of shortcuts for everyone, making it easier to find.

1. Common Shortcuts

Code Saving

  • Description: This operation can be used to quickly save while writing code

  • Invocation: Menu bar File -> Save All

  • Shortcut: Ctrl + S

Maximize/Minimize Code Editing Window

  • Description: Hide all tool windows, the code editing window will be maximized/minimized

  • Invocation: Menu bar Window -> Active Tool Window -> Hide All Windows

  • Shortcut: Ctrl + Shift + F12

  • Others:

    • Make sure to select the code editing window before executing this operation

    • When executing the Ctrl + Shift + F12 command for the second time, the window will be restored, i.e., minimized

Maximize/Minimize Tool Window

  • Description: Hide all windows, maximize/minimize the specified tool window

  • Invocation: Menu bar Window -> Active Tool Window -> Maximize Tool Window

  • Shortcut: Ctrl + Shift + Quote

  • Others:

    • Make sure to select a tool window before executing this operation

    • When executing the Ctrl + Shift + Quote command for the second time, the window will be restored, i.e., minimized

Show/Hide Tool Window

  • Description: This operation can show/hide the tool window

  • Invocation: Menu bar View -> Tool Windows -> Project

  • Shortcut: Alt + 1

Quickly Switch Scheme

  • Description: You can switch the color scheme, code style scheme, shortcut scheme, viewing mode, etc. of the code editing window, and also switch the appearance and feel scheme of this editor

  • Shortcut: Ctrl + `(backquote)

Open Settings Dialog

  • Description: This operation can quickly open the settings dialog

  • Invocation: Menu bar File -> Setting…

  • Shortcut: Ctrl + Alt + S

2. Search and Navigation Shortcuts

Jump to the line with error code

  • Description: This operation can quickly jump to the location with errors

  • Shortcut:

    • Find down: F2

    • Find up: Shift + F2

Jump to the last editing position

  • Description: As the name suggests, return to the previous position you modified the code

  • Shortcut: Ctrl + Shift + BackSpace

  • Others: You can execute the Ctrl + Shift + BackSpace command multiple times to return to earlier modification positions

Jump between methods and inner classes

  • Description: This operation allows the cursor to jump between the names of methods or inner classes in the current file

  • Invocation:

    • Menu bar Navigate -> Next Method

    • Menu bar Navigate -> Previous Method

  • Shortcut:

    • Jump down: Alt + Down Arrow

    • Jump up: Alt + Up Arrow

  • Others: Note that this operation only targets method names and inner class names, ignoring method names in anonymous inner classes

Jump to a specific line

  • Description: This operation can quickly jump to a specified line

  • Shortcut: Ctrl + G

Bookmarks

  • Description: Mark a line of code, allowing quick navigation to that line

  • Invocation: Menu bar Navigate -> Bookmarks

  • Shortcut:

    • Add/Remove Bookmark (no marker): F11

    • Add/Remove Bookmark (with marker): Ctrl + F11

    • Show Bookmarks: Shift + F11

  • Others: You can quickly locate through markers, for example: if the marker is number 1, you can locate to the line with Ctrl + 1

Close file in code editing window

  • Description: When many files are opened in the code editing window, executing this operation can close the files you do not need

  • Shortcut: Ctrl + F4

Switch between Activity files and layout files

  • Description: This operation can switch between related files, e.g., Activity files and layout files

  • Shortcut: Ctrl + Alt + Home

File switching in code editing window (1)

  • Description: If several files are opened in the code editing window, this operation can quickly switch between files

  • Shortcut: Ctrl + Tab

  • Others: When pressing Ctrl + Tab, hold down the Ctrl key and do not release it, then you can switch using the Tab key, or use the up, down, left, and right arrow keys to switch

File switching in code editing window (2)

  • Description: If several files are opened in the code editing window, this operation can quickly switch between files

  • Shortcut: Alt + Left/Right Arrow

  • Others: Hold down the Alt key and then use the left and right arrow keys to switch

Switch to code editing window

  • Description: If you are currently in the tool window and want to return to the code editing window, use this shortcut

  • Shortcut:

    • Directly return: Esc

    • Close current window and return: Shift + Esc

Switch to tool window

  • Description: If you are currently in the code window and want to return to the tool window, use this shortcut

  • Shortcut: F12

Highlight text

  • Description: When you select a word, this operation will highlight all the same words

  • Invocation: Menu bar Edit -> Find -> Highlight Usages in File

  • Shortcut:

    • Highlight: Ctrl + Shift + F7

    • Find up: Shift + F3

    • Find down: F3

    • Exit highlight: Esc

View documentation information

  • Description: This operation can view brief documentation information for properties, methods, classes, etc.

  • Invocation: Menu bar View -> Quick Documentation

  • Shortcut: Ctrl + Q

View source code

  • Description: This operation can view the source code of a certain class

  • Shortcut:

    • Keyboard operation: Ctrl + B

    • Mouse operation: Ctrl + Left Mouse Click

  • Others: Note: This operation requires moving the cursor or mouse above the class you want to understand

View file structure

  • Description: This operation will list class names, method names, and method return types in a tree structure

  • Invocation: Menu bar Navigate -> File Structure

  • Shortcut: Ctrl + F12

  • More: You can quickly jump to a certain method or class through the file structure

View recently modified files

  • Description: View recently modified files

  • Invocation: Menu bar View -> Recently Changed Files

  • Shortcut: Ctrl + Shift + E

View recently opened files

  • Description: View recently opened files

  • Shortcut: Ctrl + E

Find property or method

  • Description: This operation can find and jump to the page of the specified property or method (note: the property or method belongs to the current project)

  • Invocation: Menu bar Navigate -> Symbol…

  • Shortcut: Ctrl + Shift + Alt + N

  • Others: Execute the Ctrl + Shift + Alt + N command twice to find and jump to the page of the specified property or method (note: the property or method may not belong to the current project)

Find subclasses

  • Description: This operation mainly targets parent classes and interfaces, executing this operation will show which classes or interfaces inherit from the parent class or implement the interface

  • Shortcut: Ctrl + Alt + B

  • Others: Note: Before executing this operation, move the cursor to the parent class or interface

Find superclass

  • Description: When executing this operation, if the cursor is near extends, it will jump to the line where the superclass name is located; if the cursor is near @Override, it will jump to the line where the overridden method name is located

  • Invocation: Menu bar Navigate -> Super Method

  • Shortcut: Ctrl + U

Find class

  • Description: This operation can jump to the page of the specified class (note: the class is from the current project)

  • Invocation: Menu bar Navigate -> Class…

  • Shortcut: Ctrl + N

  • More: Execute the Ctrl + N command twice to jump to the page of the specified class (note: the class may not be from the current project)

Find file or folder

  • Description: This operation can find and jump to a certain file or folder

  • Invocation: Menu bar Navigate -> File…

  • Shortcut: Ctrl + Shift + N

  • Others:

    • For example: If searching for the .gitignore file, enter .gitignore in the search box

    • For example: If searching for the src folder under the app folder, enter app/src/ in the search box

Find

  • Description: This operation applies to the code editing window, allowing you to find the code you want based on case sensitivity, regular expressions, etc.

  • Invocation: Menu bar Edit -> Find -> Find…

  • Shortcut:

    • Enable find operation: Ctrl + F

    • Find down: F3

    • Find up: Shift + F3

Replace

  • Description: This operation is similar to the find operation, but the code you find can be replaced with other code you want

  • Invocation: Menu bar Edit -> Find -> Replace…

  • Shortcut: Ctrl + R

Find action

  • Description: You can find the shortcut for a certain action, and you can also search for actions that do not have shortcuts

  • Invocation: Menu bar Help -> Find Action

  • Shortcut: Ctrl + Shift + A

  • Others: For example: Enter Replace in the search box, then all shortcuts related to Replace will be displayed

Global search

  • Description: You can search for everything, including properties, methods, classes, files, actions, etc.

  • Shortcut: Press Shift twice in succession

3. Code Writing Shortcuts

Delete line

  • Description: Without selection, delete the line where the cursor is; when selected, delete all selected lines

  • Shortcut: Ctrl + Y

Copy line (Duplicate Line)

  • Description: Copy the content of the current line where the cursor is and paste it to the next line

  • Shortcut: Ctrl + D

  • Others: This operation will not affect the clipboard content

Move line

  • Description: Move a line directly to another position without copying and deleting

  • Shortcut:

    • Move up: Ctrl + Shift + Up Arrow

    • Move down: Ctrl + Shift + Down Arrow

  • More: Another usage: Place the cursor on the line where the method name is located, you can move the entire method

Join lines

  • Description: Merge the next line with the line where the cursor is

  • Invocation: Menu bar Edit -> Join Lines

  • Shortcut: Ctrl + Shift + J

  • Others:

    • This operation can merge strings across lines, removing the plus sign and double quotes during merging

    • This operation can merge two lines of comments, removing extra // during merging

    • This operation can merge local variable declarations and their values

Add line comment

  • Description: This operation can add comments to a line of code

  • Invocation: Menu bar Code -> Comment With Line Comment

  • Shortcut: Ctrl + /

Add block comment

  • Description: This operation can add comments to multiple lines of code

  • Invocation: Menu bar Code -> Comment With Block Comment

  • Shortcut: Ctrl + Shift + /

Delete entire word (1)

  • Description: When the cursor is placed before a word, this operation can directly delete the entire word

  • Shortcut: Ctrl + Delete

Delete entire word (2)

  • Description: When the cursor is placed after a word, this operation can directly delete the entire word

  • Shortcut: Ctrl + BackSpace

Start new line

  • Description: This operation can jump to a new line, even if the cursor is not at the end of the line

  • Shortcut: Shift + Enter

Edit simultaneously

  • Description: You can edit the same word simultaneously

  • Invocation:

    • Menu bar Edit -> Find -> Select All Occurrences

    • Menu bar Edit -> Find -> Add Selection for Next Occurrence

    • Menu bar Edit -> Find -> Unselect Occurrence

  • Shortcut:

    • Select all: Ctrl + Shift + Alt + J

    • Select one by one: Alt + J

    • Unselect one by one: Shift + Alt + J

    • Unselect all: Esc

  • Others: First, select a word to be modified, then you can perform operations

Block selection mode

  • Description: In normal selection mode, when you select down, the current line to the end of the line is directly selected, while in block selection mode, selection is based on the rectangular area selected by the mouse

  • Invocation: Menu bar Edit -> Column Selection Mode

  • Shortcut: Ctrl + Shift + Insert

  • Others: Another way is: in normal selection mode, hold down the Alt key and then use the mouse to select

Select code block

  • Description: The operation to expand the selection range is: based on the cursor position, it will first select a word or symbol, then expand to the line, then to the method, and finally to the class

  • Invocation:

    • Menu bar Edit -> Extend Selection

    • Menu bar Edit -> Shrink Selection

  • Shortcut:

    • Expand selection range: Ctrl + W

    • Shrink selection range: Ctrl + Shift + W

Collapse/Expand code block

  • Description: This operation can collapse/expand code blocks, making the code look cleaner

  • Shortcut:

    • Collapse/Expand code block (part): Ctrl + “-” / Ctrl + “+”

    • Collapse/Expand code block (all): Ctrl + Shift + “-” / Ctrl + Shift + “+”

Optimize import packages

  • Description: This operation will remove all packages that have been imported but are not used

  • Invocation: Menu bar Code -> Optimize Imports

  • Shortcut: Ctrl + Alt + O

Format code

  • Description: This operation can format code, making the code more standardized. For example: if some code is not indented according to the specification, executing this operation will indent those unindented codes according to the specification

  • Invocation: Menu bar Code -> Reformat Code

  • Shortcut: Ctrl + Alt + L

Generate common methods

  • Description: This operation can quickly generate getters, setters, constructors, hashCode/equals, toString, etc.

  • Invocation: Menu bar Code -> Generate…

  • Shortcut: Alt + Insert

Method override (1)

  • Description: This operation can quickly override methods, where the reason for overriding is that it inherits an abstract class

  • Invocation: Menu bar Code -> Override Methods…

  • Shortcut: Ctrl + O

  • Others: Note: Before executing this operation, move the cursor to the place where the method to be overridden is located

Method override (2)

  • Description: This operation can quickly override methods, where the reason for overriding is that it implements a certain interface

  • Invocation: Menu bar Code -> Implement Methods…

  • Shortcut: Ctrl + I

  • Others: Note: Before executing this operation, move the cursor to the place where the method to be overridden is located

Nested code

  • Description: Wrap the code block with specific statements, then nest it in the original statement

  • Invocation: Menu bar Code -> Surround With…

  • Shortcut: Ctrl + Alt + T

  • Others:

    • Specific statements are generally if statements, loop statements, try-catch statements, Runnable statements, etc.

    • If no code block is selected, this operation will wrap the code on the line where the cursor is located

    • Remove wrapped code block: Ctrl + Shift + Delete

Show error prompt information

  • Description: When there is an error in the code, this operation can display the error prompt information

  • Shortcut: Ctrl + F1

  • Others: Before using this operation, move the cursor to the location with the error

Import package

  • Description: This operation is used to import packages that have not yet been imported

  • Shortcut: Alt + Enter

  • Others: Before using this operation, move the cursor to the location where the package needs to be imported

Manually trigger completion prompt

  • Description: When writing code, a completion prompt appears below the code. Sometimes we want to select Log.d(); but accidentally selected Log.e();. After deleting the e() at the end, the system will not show the completion prompt. However, after executing this shortcut operation, the prompt will reappear

  • Shortcut: Ctrl + Alt + Space

Code completion (1)

  • Shortcut: Ctrl + Space

  • Others: Note: This shortcut may conflict with the input method shortcut

Code completion (2)

  • Description: You can complete part of a statement

  • Invocation: Menu bar Edit -> Complete Current Statement

  • Shortcut: Ctrl + Shift + Enter

  • Others:

    • Using this operation can complete the semicolon at the end of the statement

    • Using this operation can complete the parentheses and braces of if, for, while statements, etc.

    • If no completion is needed, executing this operation will jump to the next line, even if the cursor is not at the end of that line

Code completion (3)

  • Description: This operation will display the methods that can be called based on the position of the cursor

  • Invocation: Menu bar Code -> Completion -> Smart Type

  • Shortcut: Ctrl + Shift + Space

This article is permanently updated at the following link: https://www.linuxidc.com/Linux/2018-04/151869.htm

Editor’s personal WeChat, scan or long press to add me:

Complete Guide to Android Studio Shortcuts

Complete Guide to Android Studio Shortcuts

Click the “Read Original” below for more exciting content☺

Leave a Comment