Good idea can improve the efficiency of our work, if you grasp some shortcuts, can help us free from the tedious repetitive work, write the code to the higher efficiency, then want to share some useful shortcuts, if you have finished this, click on the below link to one of the few people know AndroidStudio shortcuts (2)
- Shortcuts to AndroidStudio that few people know
Software environment:
- Mac/Win/Linux Shortcut: Default
- AndroidStudio v3.5.0
- The following shortcut keys should be adjusted according to your keyboard for different external keyboards
Parameters of the tip
What if a method argument is super long and you don’t know what the argument is? We can use the following shortcut keys
- Mac: Cmd + P
- win/Linux: Ctrl + P
Automatic extraction method
When we optimize code, we will see smelly and long code, and our traditional way is to create a new function and copy the code, this process can be done by using the following shortcut keys
- Mac: Cmd + Alt + M
- Win/Linux: Ctrl + Alt + M
Automatic extraction parameter
During the development process, we found that it is better to pass in the variables used by the function as parameters. If you manually modify the function, it will be tedious to modify the function in every place. The following shortcut keys can free you
- Mac: Cmd + Alt + P
- Win/Linux: Ctrl + Alt + P
Of course, if you just want to reload the method, check the box that pops up
Automatic variable generation
- Mac: Cmd + Alt + V
- Win/Linux: Ctrl + Alt + V
Searches for whether a method is called
We are refactoring, optimizing, or reading someone else’s code. To find out who called a method, use the following command
Mac/Win/Linux: Alt + F7
Refactoring shortcuts
When we refactor, we can do a lot of things with shortcut keys, but there are so many shortcut keys that we can’t remember all of them. There is one shortcut that will help us
- Mac : Ctrl + T
- Win/Linux: Ctrl + Alt + Shift + T
The parcel code
- Mac: Cmd + Alt + T
- Win/Linux: Ctrl + Alt + T
Batch rename
If during development or optimization, you find that the variable name is not good, or the word is misspelled, and you need to change all the variables used, the following shortcut can free your hands
Mac/Win/Linux: shift + F6
Look at the method call hierarchy
Sometimes when we are reading code and want to know what the call structure of a method looks like, one of the following shortcuts will help you
- Mac: Control + Option + H
- Win/Linux: Ctrl + Alt + H
Look at the hierarchy of classes
When reading the source code, you can use the following shortcut keys to find out what the call structure of a class looks like
- Mac: Control + H
- Win/Linux: Ctrl + H
Error prompt
When writing code, you may encounter the warning given by IDEA. The following shortcut keys can help you effectively solve the warning
Mac/Win/Linux: Alt + Enter
summary
In order to make a summary of the above shortcut keys, because the length is too long, so the article is divided into two, click to go to the few people know the shortcut keys of AndroidStudio (2)
instructions | shortcuts |
---|---|
Parameters of the tip | Mac: Cmd + P win/Linux: Ctrl + P |
Automatic extraction method | Mac: Cmd + Alt + M Win/Linux: Ctrl + Alt + M |
Automatic extraction parameter | Mac: Cmd + Alt + P Win/Linux: Ctrl + Alt + P |
Automatic variable generation | Mac: Cmd + Alt + V Win/Linux: Ctrl + Alt + V |
Searches for whether a method is called | Mac/Win/Linux: Alt + F7 |
Refactoring shortcuts | Mac : Ctrl + T Win/Linux: Ctrl + Alt + Shift + T |
The parcel code | Mac: Cmd + Alt + T Win/Linux: Ctrl + Alt + T |
Batch rename | Mac/Win/Linux: shift + F6 |
Look at the method call hierarchy | Mac: Control + Option + H Win/Linux: Ctrl + Alt + H |
Look at the hierarchy of classes | Mac: Control + H Win/Linux: Ctrl + H |
Error prompt | Mac/Win/Linux: Alt + Enter |