Android Studio development tips
Key-bit ing of Android Studio
Android Studio provides different key-bit ing, that is, the ing between the shortcut key and its corresponding operations.Settings-> Keymap"Menu to view the currently used key-bit ing.
Highlight all Identical variables
OS X:Command+Shift+F7
Windows Or Linux:Ctrl+Shift+F7
This shortcut will highlight all the occurrences of the selected characters in the current file. Of course, this shortcut key is not only simple pattern matching, it will understand the range of the current variable, only highlight the relevant characters.
After highlighting, you can use"Edit → Find Next/Previous"To select the highlight characters you want to operate.
Related tips:
- The "return" or "throw" in the highlighted code method also highlights all exits of this method.
- Highlighting the definition of the Java class "extends" or "implements" will also highlight the corresponding override or implementation method.
- The highlighted import Statement also highlights where it is used.
- Esc can cancel highlighting.
Jump to OS X between methods and internal classes: Ctrl+ Bytes/ Bytes
Windows Or Linux: Alt+ Bytes/ Bytes
This shortcut allows you to easily jump to the method or class of the current file.
If you are currently in a method, this shortcut key is up) You can let your cursor jump to the method name. This is very helpful for you to refactor the code or find the use of this Code.
Class file structure pop-up window OS X: Command+ F12
Windows Or Linux: Ctrl+ F12
This shortcut can help you display the method structure of the current class file. You can use this shortcut to pop up a window to find the method name you want.
Related tips:
- You can use the camper characters to filter the list of candidate methods. For example, enter "oCr" to find the "onCreate" method.
- You can choose whether to display anonymous classes. If you select "yes", you can easily find the OnClick method in OnClickListener.
Method call level pop-up window OS X: Ctrl+ Alt+ H
Windows Or Linux: Ctrl+ Alt+ H
This shortcut key helps you show how a method is called.
Define quick search for OS X: Alt+ Space
Windows Or Linux: Ctrl+ Shift+ I
If you want to know the source of a class or method without losing the current encoding environment, you can try this shortcut.
Scale down or expand the code block OS X: Alt+ +/ -
Windows Or Linux: Ctrl+ Shift+ +/ -
For more information, see the right figure.
Related tips:
- You canEditor → Code Folding"Customize your code folding range.
Bookmarks to save your code site
Default tagOS X: F3
Windows Or Linux: F11Press this shortcut key to tag the row where your current cursor is located
Tags with letters or numbersOS X: Alt+ F3
Windows Or Linux: Ctrl+ F11
Press this shortcut key to tag the row where your current cursor is located and provide letters or numbers. If you select a number tag, you can directly jump to the corresponding position by pressing ctrl + corresponding number.
Display tagsOS X: Command+ F3
Windows Or Linux: Shift+ F11
Find the menu option OS X of Android Studio: Command+ Shift+ A
Windows Or Linux: Ctrl+ Shift+ A
You can enter a menu name to search for any menu options, which is very effective for operations with low frequency.
Related tips:
- If this option has a shortcut, the shortcut key is displayed next to the list.
Code row-level mobile OS X: Alt+ Shift+ Bytes/ Bytes
Windows Or Linux: Alt+ Shift+ Bytes/ Bytes
You can use this shortcut to move the code in one line, up or down. The result is as follows.
Delete row OS X: Command+ Backspace
Windows Or Linux: Ctrl+ Y
Delete the current row or selected code.