Common shortcuts for Android Studio (go to Yangpuyuan's blog)

Source: Internet
Author: User

Shortcut keys, also known as "Hot Keys", the combination of multiple keys can achieve some quick operation, such as the most commonly used in window CTRL + C and CTRL + V, skilled use of shortcut keys can greatly improve the development efficiency and can reduce the occurrence of some errors. Android Studio also has a number of shortcut keys available by default for developers to call, and it is recommended to use the default style shortcuts for Android studio.


In fact, we do not need to back down once, only in the development of the use of shortcut keys and print a shortcut key table next to the computer, often used and consulted, a period of time will form a habit.

1. Ctrl+g

Press the Ctrl+g shortcut key to pop up the quick position box, enter the row points in the box to click OK to quickly switch to the corresponding number of rows, shown in 2.17.

2. Ctrl+e

Press the Ctrl+e shortcut key at the same time, pop up the recently opened file list, can quickly select the recently opened file

3. ctrl+/

Select a row and press the ctrl+/shortcut key to annotate the line, as shown in 2.19.

4. Ctrl+f

Press ctrl+f shortcut key at the same time, will pop in the top of the edit page in the class Quick Search bar, you can quickly locate a word within the class, support Lenovo find

When you enter Prote, the protected is highlighted, and you notice that there are three checkboxes in the search bar, and the first match case check box is casing-sensitive.

5. Ctrl+r:

Ctrl+f shortcut keys and ctrl+r shortcuts are used to quickly find and replace all

Use the shortcut key ctrl+f to search all the protected, then use the shortcut key Ctrl+r pop up the replacement bar, enter the replacement word in the Replacement field input box and click the Replace All button to replace all the protected in the class to public, very fast. However, use caution in real-world development and avoid the introduction of problems that are not easily detectable.

6. Ctrl+j

Press CTRL and J shortcut keys at the same time to eject the shortcut code box

For some of the common code in Android Studio is encapsulated, directly selected can be quickly generated, very useful in development, here to print log and pop toast for example. First press the Ctrl+j shortcut, pop up the shortcut code box shown in 2.24, and then directly enter LOGD, the "command" of this shortcut code, as shown in 2.25.

Print log requires tag, at the top of the class to enter the shortcut code LOGT, you can quickly generate a tag,2.27 shown.

Similarly, enter the Ctrl+j key first, pop up the shortcut code box, and then enter toast,2.29 directly as shown.

Press the ENTER key, or if you have a toast, press TA

Is it quick and easy to generate a line of toast statements and enter the information you want toast to display in quotation marks?

7. CTRL+F12:

In the case of more than one method in a class, pressing CTRL and F12 at the same time can quickly see all the methods in the class, and when you pop this box, you can enter the method you want to search for fast matching.


1. ctrl+alt+t


Select a piece of code and press CTRL, ALT, and T to pop up the package pop-up box and select the type of package you want to wrap the selected code in.

2. Ctrl+alt+l

Format all code for the current class

2. Ctrl+alt+v

This shortcut can quickly declare a variable and assign a value to a local variable.

3. Ctrl+alt+h

Click on one of the methods to press this shortcut, in the left column to pop up the call relationship of this method, this shortcut key in development is very common.



4. Ctrl+alt+o


This shortcut can automatically guide the package or delete the useless package, when you press the shortcut key to automatically delete these useless packages

1. ctrl+shift+/


Similar to ctrl+/, is to implement the function of the comment code, ctrl+shift+/implementation of the code block comments, press the shortcut again to comment out this part of the code

This shortcut is often used in development, you can quickly search for the required information by keyword, and select the first check box to be case sensitive. Click the tab on the right to see a preview of your keywords


3. ctrl+shift+ Plus/minus


If the method is closed, press the ctrl+shift+ plus sign to expand the method,


Conversely, if the method is expanded and the ctrl+shift+ minus sign is pressed, the method

1. ALT+INSERT

press ALT and Insert key at the same time, pop up the Quick Code generation box, there are construction methods, getter/ Setter method, tostring method, etc.
 android Studio quick code Generation box
Here, for example, the build constructor method, select the constructor option
as you can see, the automatic generation of two properties of the construction method, it is convenient and fast, generate getter/ The Setter method is similar to the build construction method, which also selects both properties and presses the shortcut key, which is shown in getter and setter,2.52.
Select OK to generate both getter and setter methods for both properties

2. ALT + mouse


Pressing the ALT key together with the mouse allows you to select multiple
 android studio multi-line Select


3. CTRL + left mouse button
This shortcut can view the selected class or method of the mouse,

Common shortcuts for Android Studio (go to Yangpuyuan's blog)

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.