Set of shortcut keys for android studio

Source: Internet
Author: User

\ Item Ctrl + P to view the variable parameter information, that is, to see the type of the Variable
\ Item Ctrl + B find the location defined for this variable.
\ Item Ctrl + Q find the quick document, that is, open its declaration in another window
\ Item Alt + Shift + C view the most recent project Changes
\ Item Ctrl + space automatically complete code
\ Item Ctrl + shift + Enter Automatic Filling expression such as if, while, for, switch, etc.
\ Item Ctrl + shift + up arrow move the selected code up
\ Item Ctrl + shift + downward arrow move the selected code down
\ Item Alt + shift + F10 indicates automatic operation
\ Item Alt + number indicates opening or hiding the corresponding window
\ Item Ctrl + Click indicates the definition of this object or Class
\ Item to close all files except the current file right-click --> close others, or press and hold alt + click
\ Item Ctrl + D double the row selected
\ Item Ctrl + F search
\ Item Ctrl + R replacement
\ Item Ctrl + N open the class you want (for class switching)
\ Item Ctrl + F12 browse the member functions and member variables of the current class
\ Item Ctrl + H browse the inheritance relationship of the current class
\ Item Ctrl + O browse all member functions and member variables of the parent class of the current class
\ Item Ctrl + Insert: Used to quickly generate the getter and setter Methods
\ Item Ctrl + W select code blocks near upper and lower
\ Item Ctrl +/code line comment
\ Item Ctrl + shift +/code block comment
\ Item Shift + F1 to view corresponding classes in the browser
\ Item Ctrl + shift + space automatically generated, such as String s = (generated by pressing the shortcut key in brackets) kks, \ textbf {String s = (String) kks}
\ Item Ctrl + P display the list of available parameters of this \ textbf {method}
\ Item Ctrl + shift + backspace return the Last edited location
\ Item Ctrl + E: display the recently opened file
Locate errors everywhere in the \ item F2 file, and jump to the next error once
\ Item Alt + up arrow current cursor move to the beginning of the previous method
\ Item Alt + downward arrow move current cursor to start of next Method
\ Item Ctrl + shift + J merge adjacent two lines of code to remove unnecessary Spaces

 

 

IntelliJ IDEA tips
In the process of using InelliJ IDEA, I found many tips worth mentioning in the IDE that many Java Programmers like by searching for materials and some of my own explorations, if You Can skillfully apply them to the actual development process, I believe it will greatly save your development time, and there will be a little sense of accomplishment :) Try it!

1. When writing Code, use Alt-Insert (Code | Generate... You can create the getter and setter methods for any fields in the class.
<? Xml: namespace prefix = v ns = "urn: schemas-microsoft-com: vml"/>

2. Right-click the breakpoint marker (in the Left bar of the text) to activate the quick query menu. You can quickly set the enable/disable breakpoint or condition attributes.

3. A special variable in the CodeCompletion attribute is the class name that can be completed or not in the current file by activating Ctrl-Alt-Space. If the class is not introduced, the import flag is automatically created.

4. Use the Ctrl-Shift-V shortcut to insert the most recently used clipboard content to text. During use, the system will pop up a dialog box containing the clipboard content, from which you can select the part you want to paste.

 

5. You can use the CodeCompletion attribute to quickly complete various statements in the Code by pressing the first few letters in the Class Name field and then pressing Ctrl-Space to complete the full name. If there are multiple options, they will be listed in the Quick query list.

 

6. use Ctrl-/and Ctrl-Shift-/to comment out/uncomment code lines and code blocks.

-/Mark with a single line comment ("//… ) To comment out/uncomment the current row or select a code block. Ctrl-Shift-/can be marked with block annotations ("/*… */") To enclose the selected block. To uncomment a code block, press Ctrl-Shift-/anywhere in the block.

 

7. press Alt-Q (View | Context Info) to View the declaration of the current method without moving the code. The edited class name is displayed twice in a row.

 

8. Use Refactor | Copy Class... You can create a "copy" of the selected class ". This is useful, for example, when you want to create a class with the same content as an existing class.

 

9. In the editor, Ctrl-D can copy the selected block or the selected block is the current row.

 

10. Ctrl-W (select a word) in the editor, the function is to select a word to take off the character, and then select the extension area of the source code. For example, first select a method name, then the expression that calls the method, then the entire statement, and then tolerate blocks.

 

11. If you do not want the highlighted ball icon indicating event details to be displayed in the editor, press the Alt-Enter key combination to open the list of all events and click it to make the highlighted ball of the event text attachment inactive.

In this way, there will be no bright ball indicating a special event, but you can still use it with the Alt-Enter shortcut key.

 

12. When CodeCompletion is used, you can use the comma (.), comma (,), semicolon (;), space, and other characters to enter the current highlighted part in the pop-up list. The selected name is automatically entered into the editor with the entered characters.

 

13. You can use the Escape key in any tool window to move the focus to the editor.

Shift-Escape not only moves focus to the editor, but also hides the current (or last active) tool window.

The F12 key moves the focus from the editor to the recently used tool window.

 

14. An easy way to view any expression value during program debugging is to select text in the editor (you can press Ctrl-W to perform this operation more effectively) then press the Alt-F8.

 

15. To open the browser of the class or method Java document used in the editor to take off the character, right-click the Shift-F1 (right-click the External JavaDoc menu ).

To use this function, you must set the path to the browser in the "General" option (Options | IDE Settings ), in addition, you must add the created Java document to the Project (File | Project Properties ).

 

16. With the Ctrl-F12 (View | File Structure Popup) key, you can quickly navigate in the currently edited File.

The member list of the current class is displayed. Select an element and press Enter or F4. To easily locate an entry in the list, you just need to enter its name.

 

17. Place the cursor in the Code on the marker or its checkpoint and then press the Alt-F7 (right-click Find Usages... ) Quickly finds the location of a class, method, or variable used throughout the project.

 

18. Press Ctrl-N (Go to | Class... ) Then, you can enter the class name to quickly open any class in the editor. Select a class from the displayed drop-down list.
In the same way, you can use Ctrl-Shift-N (Go to | File... Open non-Java files in the project.

 

19. navigate to the declaration of classes, methods, or variables used in the code, place the cursor on the display item, and then press Ctrl-B. You can also press Ctrl and click the mouse button on the viewing point to go to the Declaration.


20. Place the cursor on the viewing point and press Ctrl-Alt-B to navigate to the implementation code of an abstract method.

 

21. To view the Hierarchy of the selected class, press Ctrl-H (Browse Type Hierarchy. You can also activate the inheritance relationship view in the editor to view the inheritance relationships of the current editing class. 22. Use Ctrl-Shift-F7 (Search | Highlight Usages in File) to quickly Highlight the use of a variable in the current File. Press Escape to clear the highlighted image.

 

23. Use Alt-F3 (Search | Incremental Search) in the editor for quick Search.

In the "Search for:" prompt tool, enter a character and use the arrow to Search forward and backward. Press Escape to exit.

 

24. Press Ctrl-J to execute the abbreviated Live Template that you cannot remember. For example, press "it" and Ctrl-J to see what happened.

 

25. Introduce Variable integration helps you simplify complex declarations in your code. For example, in the following code snippet, select an expression in the Code: press Ctrl-Alt-V.

 

26. Press Ctrl-Shift-J to merge the two rows and remove unnecessary spaces to match your code format.

 

27. Ctrl-Shift-Backspace (Go to | Last Edit Location) transfers you to the Last place of the change in the Code.

Press Ctrl-Shift-Backspace several times to view the deeper modification history.

 

28. use Tools | Reformat Code... Refer to (view Options | IDE Setting | Code Style) to format the Code according to your Code Style.

Use Tools | Optimize Imports... You can set (view Options | IDE Setting | Code Style | Imports) to automatically "optimize" imports (clear useless imports, etc ).

 

29. Using IDEA Live Templates | Live Templates allows you to create a lot of typical code in the twinkling of an eye. For example, Type

Press the Tab key to see what happened.
Use the Tab key to move in different template domains. View Options | Live Templates for more details.

 

30. To view the modified Local History in a file, activate Local VCS in the right-click menu | Show History... . Maybe you can navigate to different file versions to see their differences and roll back to any previous version.

You can also view the modification history in a directory using the same right-click menu entry. With this feature, you will not lose any code.

 

31. If you want to know the purpose of each entry in the main menu, move the mouse pointer to the menu entry, and then the status bar at the bottom of the application framework will display some brief descriptions of them, it may be helpful to you.

 

32. to display the separation lines between methods in the Editor, Open Options | IDE Settings | Editor and select the "Show method separators" check box (checkbox ).

 

33. You can use the Alt-Up and Alt-Down keys to quickly move between different methods in the editor.

 

34. jump between highlighted syntax errors with F2/Shift-F2 keys.

You can use the Ctrl-Alt-Down/Ctrl-Alt-Up shortcut to jump between the compiler error message or the search results.

 

35. Press Ctrl-O (Code | Override Methods... ) Can easily reload the basic method.

To complete the method of the implements (or abstract basic class) interface of the current class, use Ctrl-I (Code | Implement Methods... ).

 

36. If the cursor is placed between the brackets of a method call, press Ctrl-P to display a list of available parameters.

37. to quickly view the Java document of the class or method used in the editor's escape character, press Ctrl-Q (in Show Quick JavaDoc in the pop-up menu.

38. For example, Ctrl-Q (Show Quick JavaDoc shows simple Java documents), Ctrl-P (Show Parameter Info shows Parameter information), Ctrl-B (Go to Declaration to jump to Declaration ), shift-F1 (External JavaDoc External Java documentation) and some other shortcuts can be used not only in the editor, but also in the right-click list of code completion.

 

39. Press Ctrl-E (View | Recent Files) to pop up the right-click list of recently accessed Files. Press Enter to open the selected file.

 

40. In IDEA, you can easily rename your classes, methods, and variables and automatically correct them wherever they are used.

Try, place the editor off the character on any variable name, and then press the Shift-F6 (Refactor | Rename... ). In the dialog box, type a new name to be displayed and then press Enter. You will browse all the places where this variable is used and then click "Do Refactor" to end the RENAME operation.

 

41. In any View (Project View, Structure View, or other View ),

Select the current editing location (class, file, method or field), by Alt-F1 (View | Select in... ).


42. when instantiating a known type object after the "new" character, you may use the SmartType code to complete this feature. For example, Type

Press Ctrl-Shift-Space:

43. By using the SmartType code, it is very easy to create the entire anonymous implementation of the interface in idea. For example, for some listener listeners, you can type

Component component;

Component. addMouseListener (

New <caret is here>

);

Then press Ctrl-Shift-Space to see what happened.

 

44. It is helpful to use the SmartType code when you need to set the value of a known expression. For example, Type

String s = (<caret is here>

Press Ctrl-Shift-Space to see what will happen.

 

45. Fast query is provided in all views: You can quickly locate an entry by typing characters in the tree.

 

46. When you want to capture exceptions with a Code snippet, select the snippet in the editor and press Ctrl-Alt-T (Code | Surround... ) Then select "try/catch ". It automatically generates capture blocks for all exceptions thrown in the code snippet. In the Options | File Templates | Code tab, you can also customize the template that generates the capture block.

Other items in the list can enclose other structures.


47. When the code is used, you can use the Tab key to enter the highlighted part in the pop-up list.

Unlike using the Enter key to accept input, the selected name will overwrite other parts of the name on the right of the escape character. This is particularly useful when you replace another method or variable name.

 

48. When declaring a variable, the Code Completion feature will show you a suggested name. For example, start typing "private FileOutputStream" and press Ctrl-Space.


In Options | IDE Setting | Code Style, you can also customize names for local variables, parameters, instances, and static fields.

 

Related Article

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.