Author: OCNYang
Word Selection
Generally, the IDE moves the cursor by words using option + arrow keys (for Windows, it’s ctrl + left/right arrow keys), but since we often use camel case naming, the default behavior causes the cursor to jump between the ends of multiple words in camel case. Fortunately, AS allows setting this style.
Default Effect

Modified Effect

Modification Steps
Open Preferences as shown in the image.

Note: (Thanks to the friend below for the comment pointing out this issue) If you still want to select the entire word when double-clicking on a word, you need to set as follows:
File | Settings to open settings
Select Editor | General
Uncheck ‘Mouse’ | ‘Honor Camel Humps words settings when selecting on double click’
Show Recent Operations, Modified Files
For example: I opened the main_activity.xml layout file, and then closed the page. At this time, Command + E will show the previously operated files as follows.

Then, to view previously modified files, just use Command + Shift + E. You can quickly switch interfaces with Control + Tab.
Shortcuts
-
Recent Operations
-
Command + E (mac)
-
ctrl + E (win)
-
Recently Modified
-
Command + Shift + E (mac)
-
ctrl + shift + enter (win)
File Search
search Everywhere
Global search function for files in the project
Find Class Files
-
command + o (mac)
-
ctrl + n (win)
By default, it only searches for class files in the project code. If you need to search for related classes in the SDK or libraries, press the shortcut again or check the option below to search global class files.
Find Files
This level is broader than the above. It includes all files, such as xml, etc.
-
command + shift + o (mac)
-
ctrl + shift + n (win)
As above, if you need to search libraries or source code, press the shortcut again or check the option to search for classes as shown in the image.
Operation Records
When browsing the code structure, many times you will follow many classes inside. If you want to return to the previous browsing point, then you must remember this shortcut.
-
Command + Option + Left
ight or command + [, command + ] (mac) -
ctrl + alt + Left
ight(win)
Move Lines
This does not need much introduction; it is to move whole lines up and down.
-
Option + shift + arrow key uputton (mac)
-
alt + shift + arrow key uputton (win)
Find Method Calls
Scenario: Find where a method is called or where an ID is referenced. Select this method right-click, and choose Find Usages.
Shortcut:
-
option + F7 (mac)
-
alt + F7 (win)
Follow Method
Methods are always accompanied by transitions, and we always want to check the details inside the method. A common way is to hold Command and click on the method name.
You can also directly follow the method internally by using Command + B at the cursor position.
-
Command + B (mac)
-
ctrl + alt + B (win)
Show Method Parameters
When we use a method, all parameters are displayed at the beginning. But after a while, they may not exist. If you want to know what type the next parameter is or look at all parameters.

.
Shortcut:
-
command + P (mac)
-
ctrl + P (win)
If you want to view the documentation of the method without going through the source code, directly press the F1 key to display the documentation.
Quick Line Operations
Quickly delete a line, you can actually use the cut function Command + X
Quickly copy a line, use command + Dmac, ctrl + Dwin
Multi-line Operations
Sometimes we may declare a series of related variables as float types, but what we actually need is int type. At this time, you can perform multi-selection for overall modification. As shown below:

Hold down the option (for Windows, it’s alt) key, then use the mouse to select the area. Then make the corresponding modification.
You might think that the above must be continuous. So if you can set multiple cursor points, can this meet your needs?
Look at the image below:

-
option + shift + mouse click (mac)
-
alt + shift + mouse click(win)
You can add an editing cursor. Finally, if you don’t need it, just press esc to close the extra cursor.
Quick Completion
Create an object. Or findViewById() sometimes requires moving the mouse or cursor to the end to complete the semicolon. All of these can be done with shortcuts. Once you get used to it, it will be very convenient to use.
-
command + shift + enter(mac)
-
ctrl + shift + enter(win)
Implemented Features
-
Add method body braces
-
Add semicolon at the end of the line
-
Automatic formatting and line break operations, etc.
Code Suggestions
Code suggestions can be triggered anywhere.
control + option + / (not default, mac defaults to control + space). Here it should be noted that after the code suggestion, the enter key is usually used to confirm. When pressing enter, it will retain the content after the cursor. When sometimes we do not need it, you can use the tab key to select. It will delete the subsequent input content.
The shortcut for Windows is ctrl + space (the Windows shortcut often conflicts with the input method, please manually modify the shortcut in the AS settings under keymap).

Quick Variable Generation
For example, in the method body, typing logi directly generates a log output template, but the TAG constant has not been declared. At this time, move the cursor to TAG and use the shortcut to prompt for quick generation.
-
option + enter(mac)
-
alt + enter(win)
Quick Variable Operations

The above image used the shortcut twice,
First: Jump to the variable declaration
-
command + B (mac)
-
ctrl + b (win)
Second: Jump to the variable type definition
-
command + shift + B (mac)
-
ctrl + shift + b (win)
Code Folding
Fold and expand code blocks.
-
command + plus/minus(mac)
-
ctrl + plus/minus (win)
Preview Method Definition
If you just want to get a general idea of the method definition without jumping to the source code class, you can preview it by Command + Y (the Windows shortcut is ctrl + shift + I).

Clipboard Management
For copying and pasting. We are used to single-time c+v, but if you want to see the previously covered copied content, AS also has clipboard management. It shows the recent copied content.

-
command + shift + v (mac)
-
ctrl + shift + v (win)
Split Window

Just right-click on the tab and select split vertical/horizontal.
Variable Naming Style
Member variables should start with m. Static members are usually prefixed with s. You can set this style.

Thus, when entering a variable name, it can automatically complete m or s. At the same time, when generating extra code, the generated code can automatically refactor according to this rule.
View Outline
When a class is large, you can open the outline interface by command + F12(for Windows, it is ctrl + F12) to display the list of all methods and member variables.

It also supports fuzzy search to filter and display. You can quickly find the method set you want to search.
Bookmarks
When browsing large code or debugging, sometimes you may need to remember some key code or methods. At this time, you can use bookmarks to record this key code. Just click on the line you want to mark and press F3, and a small checkmark will appear on the left side, indicating that a bookmark has been set.
At the same time, in the Favorites tab, you can also find the corresponding Bookmarks.
You can quickly bring up the bookmarks panel for subsequent operations using the shortcut command + F3 (for Windows, it’s shift + F11).
When a code snippet is ready for refactoring, you can use control + T (for Windows, it’s ctrl + alt + shift + T) to open the refactoring entry or right-click to select Refactor to display the refactoring interface.
There are many convenient functions here, such as method extraction, etc.
When wrapping a segment of code with conditions, catching exceptions, loops, Runnable, etc., you can directly use the shortcut method instead of manually generating conditions and copying-pasting code blocks.

Shortcut Keys
-
command + option + T(mac)
-
ctrl + alt + T(win)
Extract
You can often use it to extract a method.

Not only that, you can also extract the same properties of multiple controls in xml as a style.

Shortcut Keys:
-
ctrl + alt + shift + T(win)
Isn’t it great?
This is just one aspect; for xml, you can not only extract styles but also extract layout layouts.
3. Code Templates
AS has built-in many code templates, allowing you to quickly complete the code you used to memorize. Here’s a small portion of it.

You can call up these code templates using shortcuts.
-
command + J(mac)
-
ctrl + J(win)
Google provides many code analysis tools, which are concentrated in the top menu bar under Analyze.
Inspect Code & Code Cleanup
Inspect Code allows the IDE to analyze the entire project, similar to Lint analysis, and will provide general modification suggestions.
Code Cleanup function can perform automatic code repairs.
Dependencies
Through several Dependencies options in Analyze, you can quickly analyze project dependencies.
Method Call Stack
5. Breakpoint Debugging
Conditional Breakpoints. Mainly used in loops. For a loop that runs 10 times, only want to enter the breakpoint on the 8th time.
Similar to normal breakpoints, first declare a breakpoint, then right-click on the normal breakpoint. Fill in the breakpoint condition in the pop-up menu as follows:

In the image above, Enable can control whether to enable or disable a breakpoint.
Temporary Breakpoints. If you need a breakpoint that only executes once, after execution, the breakpoint is automatically canceled. You can set the current line as a temporary breakpoint using the shortcut.

-
command + option + shift + F8
-
ctrl + alt + shift + F8
To keep the length short, I will paste a detailed post about debugging.
-
Comprehensive Guide to Debugging in Android Studio (http://blog.csdn.net/dd864140130/article/details/51560664)
The reference table lists the names of keymap shortcuts. You can directly search for keymap in the AS settings interface to add or modify shortcuts by the corresponding shortcut name.




