1. Print the log:
LOGT, enter: auto generate static tag:
privatestaticfinal"MainActivity";
LOGD Enter
Loge Enter
Automatically generate print log
If you want to print parameters: Logm Enter
Auto Import Package: The package will not be imported automatically when you enter it, you need to set it up:
Under the setting:
2. Common shortcut keys
Code hint shortcut:ctrl+alt+ space
Move up and down one line of code:Ctrl+shift+up/down
Copy one line of code:ctrl+d
Delete one line of code:ctrl+y
Quick move between methods:Alt+up/down
Quickly select one or more lines of code:ctrl+w (try multiple times)
This is enough to write code.
Quick Find Open a class:Ctrl + N
Quickly find a file (such as XML):ctrl+shift+n
To quickly find a method in a class:ctrl+shift+alt+n
Show all methods in a class (fast switching method):ctrl+f12////////////
To view the parent class of a class:ctrl+u
See where a method is called: in the implementation of the method:ctrl+alt+h
See the implementation of a method (before you know it):ctrl+shift+i
Show class structure diagram:ctrl+h
Code return shortcut key:ctrl+alt+left
Switch between multiple windows:alt+left/right//////////////
Code folding and unwinding:ctrl++/-/////////////
Collapse Expand left panel:alt+1///////////
Overwrite the parent class method:ctrl+o///////////
Fast locating curly braces (one method is long):ctrl+{/}/////////
Select a statement to quickly add statements such as If,for,try catch:ctrl+alt+t//////
3. Generate code automatically
A shortcut key:ctrl+j
Then we write something:
Like what:
1. Null Judgment: Ifn/inn:
Enter:
if (data == null) { }
2.for Loop: For
3.findviewbyid:fbc
4.setvisibility:visible
.setVisibility(View.VISIBLE);
5. Print Toast:toast
Toast.makeText(MainActivity.this"", Toast.LENGTH_SHORT).show();
Summary: Ctrl+j is still very powerful, there are many features, to explore their own.
4. Code Lookup Replace formatting
Search:ctrl+f
Replacement:ctrl+r
Recent files:ctrl+e
format Code :ctrl+alt+l(as if and QQ lock repeat, turn off QQ or change QQ shortcut key)
5.Debug
First you need to add a breakpoint.
Run the program
F8 Single Step
F7 Entering method interior
Skip to Next breakpoint:Shift+f8
View variable information without modifying the source code, such as forgetting to add a log statement during the debug process, as follows:
But I want to see the value of I, you can right-click on the breakpoint:
After clicking More, add the output statement:
Then you can see the value of the console output I in one step, or it is very convenient.
7. Cancel breakpoint: Click on the breakpoint directly.
6. Summary
There are many shortcut keys, in the setting directory:
Play Turn Androidstudioide