Shortcut Keys for Android Studio

Source: Internet
Author: User

Android Studio is an Android development tool developed by Google based on IntelliJ IDEA. It is a bit similar to EcliPSe ADT. Android Studio provides integrated Android development tools for development and debugging, and supports building based on Gradle.

A large number of developers are now switching to Android Studio development. To learn development more quickly, you must learn how to use shortcut keys, so that you can sort them out and find them easily.

I. Common shortcut keys

Save code

  • Description: This operation can be used for quick saving during code writing.
  • Call: menu bar File-> Save All
  • Shortcut: Ctrl + S

Maximized/minimized code editing window

  • Description: hides all Tool Windows. The code editing window is maximized/minimized.
  • Call: menu bar Window> Active Tool Window> Hide All Windows
  • Shortcut: Ctrl + Shift + F12
  • Others:
    • You must select the code editing window before performing this operation.
    • The second time you run the Ctrl + Shift + F12 command, the window will be restored, that is, minimized.

Maximized/minimized tool window

  • Description: hides all windows to maximize/minimize the specified tool windows.
  • Call: menu bar WIndow> Active Tool Window> Maximize Tool Window
  • Shortcut Key: Ctrl + Shift + quotation marks
  • Others:
    • You must select a tool window before performing this operation.
    • The second time you run the Ctrl + Shift + quotation mark command, the window will be restored, that is, minimized.

Show/hide tool window

  • Description: This operation can display or hide the tool window.
  • Call: menu bar View> Tool Windows> Project
  • Shortcut: Alt + 1

Quick Switch Solution

  • Description: You can switch the color scheme, code style scheme, shortcut key scheme, and view mode of the code editing window, and switch the appearance and feeling scheme of the editor.
  • Shortcut: Ctrl + '(backquote)

Open Setting Dialog Box

  • Description: The change operation allows you to quickly open the Setting dialog box.
  • Call: menu bar File-> Setting...
  • Shortcut: Ctrl + Alt + S
2. search and navigation shortcuts

Jump to the row with error code

  • Description: This operation can be quickly redirected to a location with errors.
  • Shortcut Key:
    • Search down: F2
    • Search up: Shift + F2

Jump to the previous editing position

  • Description: return to the previous position where you modified the code, as the name implies.
  • Shortcut: Ctrl + Shift + BackSpace
  • Others: You can execute the Ctrl + Shift + BackSpace command multiple times to return the previous modification location.

Jump between methods and internal classes

  • Description: This operation redirects the cursor between the method of the current file or the name of the internal class.
  • Call:
    • Menu Bar Navigate-> Next Method
    • Menu Bar Navigate-> Previous Method
  • Shortcut Key:
    • Jump down: Alt + down arrow
    • Jump up: Alt + up arrow
  • Others: note that this operation only applies to the method name and internal class name, and ignores the method name in the anonymous internal class.

Jump to a line

  • Description: This operation can be quickly redirected to a specified row.
  • Shortcut: Ctrl + G

Bookmarks

  • Description: Mark the code line. You can quickly locate the line of code by marking it.
  • Call: menu bar Navigate-> Bookmarks
  • Shortcut Key:
    • Add/Remove bookmarks (no mark): F11
    • Add/Remove bookmarks (with tags): Ctrl + F11
    • Show bookmarks: Shift + F11
  • Others: You can quickly locate a tag by using a tag. For example, if the tag is a number of 1, you can locate the row of the tag by pressing Ctrl + 1.

Close the file in the code editing window

  • Description: when many files are opened in the code editing window, you can disable unnecessary files by performing this operation.
  • Shortcut: Ctrl + F4

Switch between Activity files and layout files

  • Description: This operation can be performed between associated files, for example, Activity files and layout files.
  • Shortcut: Ctrl + Alt + Home

File switching in the code editing window (1)

  • Description: If several files are opened in the code editing window, you can use this operation to quickly switch between files.
  • Shortcut: Ctrl + Tab
  • Others: When you press Ctrl + Tab, do not stop using the Ctrl key. Then you can use the Tab key to switch, or use the up, down, and down arrow keys to switch.

File switching in the code editing window (2)

  • Description: If several files are opened in the code editing window, you can use this operation to quickly switch between files.
  • Shortcut Key: Alt + left and right arrow keys
  • Others: Press and hold the Alt key, and then use the left and right arrow keys to switch

Switch to the code editing window

  • Description: This shortcut key is used if you are in the tool window and want to return to the code editing window.
  • Shortcut Key:
    • Return: Esc
    • Close the current window and return: Shift + Esc

Switch to the tool window

  • Description: This shortcut key is used if you are in the code window and want to return to the tool window.
  • Shortcut: F12

Highlight text

  • Description: When you select a word, the Operation will highlight all the same words.
  • Call: menu bar Edit-> Find-> Highlight Usages in File
  • Shortcut Key:
    • Highlight: Ctrl + Shift + F7
    • Search up: Shift + F3
    • Search down: F3
    • Exit highlight: Esc

View Document Information

  • Description: This operation allows you to view brief document information about attributes, methods, and classes.
  • Call: menu bar View-> Quilk quota etation
  • Shortcut: Ctrl + Q

View Source Code

  • Description: This operation allows you to view the source code of a class.
  • Shortcut Key:
    • Keyboard operation: Ctrl + B
    • Mouse operation: Ctrl + left mouse click
  • Others: Note: move the cursor or mouse over the class you want to know

View File structure

  • Description: This operation lists the class name, method name, and return value type of the method in a tree structure.
  • Call: menu bar Navigate-> File Structure
  • Shortcut: Ctrl + F12
  • More: You can quickly jump to a method or class through the file structure

View recently modified files

  • Description: Used to view recently modified files.
  • Call: menu bar View-> Recently Changed Files
  • Shortcut: Ctrl + Shift + E

View recently opened files

  • Description: Used to view recently opened files.
  • Shortcut: Ctrl + E

Search for attributes or methods

  • Description: This operation can be used to search for and jump to the page of the property or method you specified (note: this property or method belongs to the current project)
  • Call: menu bar Navigate-> Symbol...
  • Shortcut: Ctrl + Shift + Alt + N
  • Others: Execute the Ctrl + Shift + Alt + N command twice to search for and jump to the page of your specified attribute or method (Note: This attribute or method may not belong to the current project)

Search subclass

  • Description: This operation is mainly for the parent class and interface. After performing this operation, you will know which classes or interfaces inherit the parent class or implement this interface.
  • Shortcut: Ctrl + Alt + B
  • Others: Note: Before performing this operation, move the cursor to the parent class or interface

Find parent class

  • Description: When this operation is performed, if the cursor is near extends, it will jump to the row where the parent class name is located. If the cursor is near @ Override, it will jump to the row where the name of the Override method is located.
  • Call: menu bar Navigate-> Super Method
  • Shortcut: Ctrl + U

Search Class

  • Description: This operation can jump to the page of the specified class (Note: This class is the class of the current project)
  • Call: menu bar Navigate-> Class...
  • Shortcut: Ctrl + N
  • More: run the Ctrl + N command twice to jump to the page of the class you specified (Note: This class can not be the class of the current project)

Search for files or folders

  • Description: This operation can be used to search for and jump to a file or a folder.
  • Call: menu bar Navigate-> File...
  • Shortcut: Ctrl + Shift + N
  • Others:
    • For example, if you want to find the. gitignore file, enter. gitignore in the search box.
    • For example, if you want to find the src folder under the app folder, enter app/src/in the search box/

Search

  • Description: This operation acts on the code editing window. You can search for the code you want based on the case and regular expression.
  • Call: menu bar Edit-> Find...
  • Shortcut Key:
    • Enable search: Ctrl + F
    • Search down: F3
    • Search up: Shift + F3

Replace

  • Description: This operation is similar to a search operation. The difference is that the code you find can be replaced with other code you want.
  • Call: menu bar Edit-> Find-> Replace...
  • Shortcut: Ctrl + R

Search operation

  • Description: You can search for shortcuts for an operation. You can also search for and execute operations without shortcuts.
  • Call: menu bar Help-> Find Action
  • Shortcut: Ctrl + Shift +
  • Others: for example, if you enter Replace in the search box, all the Replace shortcut keys will be displayed.

Global Search

  • Description: You can search for everything, including attributes, methods, classes, files, and operations.
  • Shortcut Key-Shift twice in a row
3. coding shortcuts

Delete row

  • Description: Delete the row where the cursor is located without selection. Delete all selected rows if selected.
  • Shortcut: Ctrl + Y

Copy a row (Duplicate Line)

  • Description: copy the content of the row where the current cursor is located and paste it to the next row.
  • Shortcut: Ctrl + D
  • Others: this operation does not affect the clipboard content.

Move rows

  • Description: You can directly move a row to another location without copying or deleting it.
  • Shortcut Key:
    • Move up: Ctrl + Shift + up arrow
    • Move down: Ctrl + Shift + down arrow
  • More: place the cursor in the row where the method name is located to move the entire Method

Join Lines)

  • Description: Merge the next row with the row where the cursor is located.
  • Call: menu bar Edit-> Join Lines
  • Shortcut: Ctrl + Shift + J
  • Others:
    • This operation can merge cross-row strings and remove the plus signs and double quotation marks when merging.
    • This operation can merge two lines of comments and remove unnecessary comments when merging //
    • This operation can merge the declaration of local variables and the value of local variables.

Add line comment

  • Description: This operation can add comments to a line of code.
  • Call: menu bar Code-> Comment With Line Comment
  • Shortcut: Ctrl +/

Add block comment

  • Description: This operation can add comments for multiple lines of code.
  • Call: Code on the menu bar> Comment With Block Comment
  • Shortcut: Ctrl + Shift +/

Delete the entire word (1)

  • Description: When the cursor is placed before a word, the entire word can be deleted directly.
  • Shortcut: Ctrl + Delete

Delete the entire word (2)

  • Description: When the cursor is placed on a word, the entire word can be deleted.
  • Shortcut: Ctrl + BackSpace

Start new line

  • Description: This operation can jump to a new line, even if the cursor is no longer at the end of the line
  • Shortcut Key: Shift + Enter

Modify at the same time

  • Description: you can modify the same word at the same time.
  • Call:
    • Menu Bar Edit-> Find-> Select All Occurrences
    • Menu Bar Edit-> Find-> Add Selection for Next Occurrence
    • Menu Bar Edit-> Find-> Unselect Occurrence
  • Shortcut Key:
    • Select All: Ctrl + Shift + Alt + J
    • Select one by one: Alt + J
    • Cancel selection one by one: Shift + Alt + J
    • Cancel all selection: Esc
  • Others: select a word to be modified, and then you can perform the operation.

Block Selection Mode

  • Description: In normal selection mode, When you select downward, the current row is directly selected at the end of the line. In block selection mode, the selection is based on the rectangular area selected by the mouse.
  • Call: menu bar Edit-> Column Selection Mode
  • Shortcut: Ctrl + Shift + Insert
  • Others: In normal selection mode, press and hold the Alt key, and then use the mouse to select

Select Code Block

  • Description: The operation to expand the selection range is to select a word or symbol Based on the cursor position, then expand to the row, then to the method, and then to the class.
  • Call:
    • Menu Bar Edit-> Extend Selection
    • Menu Bar Edit-> Shrink Selection
  • Shortcut Key:
    • Expanded Selection Range: Ctrl + W
    • Narrow down the selection scope: Ctrl + Shift + W

Collapse/expand code blocks

  • Description: This operation can collapse or expand code blocks to make the Code look more concise.
  • Shortcut Key:
    • Collapse/expand code blocks (partial): Ctrl + "-"/Ctrl + "+"
    • Collapse/expand code blocks (all): Ctrl + Shift + "-"/Ctrl + Shift + "+"

Optimize the import package

  • Description: This operation will clear all the packages imported but not used.
  • Call: menu bar Code-> Optimize Imports
  • Shortcut: Ctrl + Alt + O

Format code

  • Description: This operation can format the code to make the code more standard. For example, if some code is not indented according to the standard, after this operation is executed, the code without indentation will be indented according to the standard.
  • Call: menu bar Code-> Reformat Code
  • Shortcut: Ctrl + Alt + L

Common generation methods

  • Description: This operation can quickly generate getters, setters, constructors, hashCode/equals, toString, etc.
  • Call: menu bar Code-> Generate...
  • Shortcut: Alt + Insert

Method rewriting (1)

  • Description: This operation can be used to quickly override methods. The reason for rewriting is that it inherits the abstract class.
  • Call: menu bar Code-> Override Methods...
  • Shortcut: Ctrl + O
  • Others: Note: Before performing this operation, move the cursor to the place where you want to override the method.

Method rewriting (2)

  • Description: This operation can be used to quickly override a method. The reason for rewriting is that an interface is implemented.
  • Call: menu bar Code-> Implement Methods...
  • Shortcut: Ctrl + I
  • Others: Note: Before performing this operation, move the cursor to the place where you want to override the method.

Nested code

  • Description: A code block is enclosed by a specific statement and nested in the original statement.
  • Call: Code on the menu bar> Surround...
  • Shortcut: Ctrl + Alt + T
  • Others:
    • A specific statement is generally an if statement, a loop statement, a try-catch statement, or a Runnable statement.
    • If no code block is selected, this operation will wrap the code of the row where the cursor is located.
    • Remove the package code block: Ctrl + Shift + Delete

Show error message

  • Description: When an error occurs in the code, you can use this operation to display the error message.
  • Shortcut: Ctrl + F1
  • Others: before using this operation, you need to move the cursor to a wrong place

Import package

  • Description: This operation is used to import packages that have not been imported.
  • Shortcut: Alt + Enter
  • Others: before using this operation, you need to move the cursor to the place where you want to import the package

Manual call-up completion prompt

  • Description: The completion prompt is displayed below the code when we write the code. Sometimes we want to select Log. d (); but accidentally selected Log. e (); if you delete the following e (), the system will not display the completion prompt, but after you finish the shortcut key operation, the prompt will appear again
  • Shortcut: Ctrl + Alt + Space

Code Completion (1)

  • Shortcut: Ctrl + Space
  • Others: Note: The shortcut key may conflict with the shortcut key of the input method.

Code Completion (2)

  • Description: Partial statements can be supplemented.
  • Call: menu bar Edit-> Complete Current Statement
  • Shortcut: Ctrl + Shift + Enter
  • Others:
    • You can use this operation to complete the semicolon at the end of the statement.
    • This operation can be used to complete the parentheses and curly braces of if, for, while, and other statements.
    • If no completion is required, the Operation will jump to the next line, and the real-time cursor is not at the end of the line

Code Completion (3)

  • Description: This operation displays the methods that can be called here based on the cursor position.
  • Call: Code on the menu bar> Completion> Smart Type
  • Shortcut: Ctrl + Shift + Space
Iv. refactoring shortcuts

Extract variable

  • Description: When you write only one variable value, this operation will help you quickly generate the variable type and variable name. For example, if you write 1.0, it may help you generate Double v = 1.0;
  • Call: Refactor-> Extract-> Variable...
  • Shortcut: Ctrl + Alt + V

Extract attributes

  • Description: If you place the cursor in the row where the local variable is located and perform this operation, the local variable is re-formed.
  • Call: Refactor-> Extract-> Feild...
  • Shortcut: Ctrl + Alt + F

Extract constant attributes

  • Description: If you place the cursor in the row where the local variable is located and perform this operation, the local variable is refactored into the constant attribute.
  • Call: Refactor-> Extract-> Constant...
  • Shortcut: Ctrl + Alt + C

Extract Parameters

  • Description: You can extract the variables defined in the method into the parameters of the method, or extract these variables to construct a new method.
  • Call: Refactor-> Extract-> Parameter...
  • Shortcut: Ctrl + Alt + P
  • Others: When extracting parameters, you need to move the cursor to the row of the variable to be extracted.

Extraction Method

  • Description: When the code in a method is too complex, you can use this operation to extract some code and generate another method.
  • Call: Refactor-> Extract-> Method in the menu bar
  • Shortcut: Ctrl + Alt + M

Replication class

  • Description: This operation can directly copy the class where the cursor is located to the specified place.
  • Shortcut: F5

Mobile

  • Description: This operation can directly move the class at the cursor to the specified place.
  • Shortcut: F6

Rename

  • Description: Class, method, and variable can be renamed.
  • Call: Refactor-> Rename...
  • Shortcut Key: Shift + F6

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.