Action |
Mac OSX |
Win/linux |
Comment Code (//) |
CMD +/ |
Ctrl +/ |
Comment Code (/**/) |
CMD + Option +/ |
Ctrl + Alt +/ |
Formatting code |
CMD + Option + L |
Ctrl + Alt + L |
Clear Invalid Package reference |
Option + Control + O |
Alt + Ctrl + O |
Find |
CMD + F |
Ctrl + F |
Find + Replace |
CMD + R |
Ctrl + R |
Move code up and down |
Option + Shift + up/down |
Alt + Shift + up/down |
Delete Row |
CMD + Delete |
Ctrl + Y |
Expand Narrow Selection |
Option + Up/down |
Ctrl + W/ctrl + Shift + W |
Quick Build Structure |
CMD + Option + T |
Ctrl + Alt + T |
Quick Overwrite Method |
Ctrl + O |
Ctrl + O |
Quick position to beginning/end |
CMD + left/right |
Ctrl + left/right |
Collapse Unwind code block |
CMD + Plus,minus |
Ctrl + Plus/minus |
Collapse Expand all code blocks |
CMD + Shift + plus,minus |
Ctrl + Shift + plus,minus |
File method Structure |
CMD + F12 |
Ctrl + F12 |
Find the location of a method call |
Ctrl + Option + H |
Ctrl + Alt + H |
Uppercase and lowercase conversions |
CMD + Shift + U |
Ctrl + Shift + U |
Automatic Guide Package
Finally, we introduce one of the most useful settings, we only have to refer to some classes each time we have to guide the package, and studio can be set by automatic Guide package, simply too practical.
To Preferences, Editor, Auto Import, Java put the following options on the OK Debug tip: Conditional breakpoints can be added to a breakpoint by right-clicking a breakpoint. The breakpoint is entered only when the condition is met. Debugging divine skill, only to the situation of their own care to debug, not wasting time.
Enter debug mode
Click Attach Debugger (the one next to the green bug) to quickly get to the debug without redeploying and launching the app.
You can choose to set a shortcut key for this feature or call it by entering "attach" in the previously mentioned find Actions (Ctrl+shift+a).
Quickly view the value of a variable
Alt-click the variable or statement you want to view. If you want to see more, you can press Alt+f8 to bring up the Evaluate Expression window to enter your own custom statements.
Analyzing stack Information
Find Actions (ctrl+shift+a) enter "Analyze StackTrace" to view the stack information.
Analyze the origin of a value
Find Actions (ctrl+shift+a) enters "Analyze Data Flow to Here", and you can see how the value of one parameter of a variable is assigned to it.
is useful for parsing code. Expert Tips
This has been discussed many times, go directly to as Setting->editor->code Style->live Templates, the first time to go in to feel the same as the discovery of the new continent.
Beginner's: Fori,foreach
Advanced point: Data sets and variables are entered after. for (eg. list.for), press ENTER: Common as in operations (?: Command,?: CTRL,?: Shift,?: Alt/option,?: Enter/return Alt need Fn+option press out F1~F12 need to press FN plus corresponding key to press out) • Save, Cmd+s this in as in fact is automatically saved. Even if you close the tab page and open it again, Cmd+z can undo the edit.) Find shortcut commands in the current class Quick Preview method implementation Cmd+y) Cmd+?a• Getter, setter, toString, constructor ... Cmd+N·) class level: Ctrl+h) in the current project (a project can have multiple Moudle) to search for Class:cmd+o and then press once Cmd+o (will find the upper right corner of the option ticked), the search results can contain non-project class, such as the class in the Android.jar in external libraries
Can be followed by the search text: linenumber to navigate to a row
• Search for file in current project (contains the above class results): Cmd+?o again cmd+?o, search results can contain flie in non-project, such as file in res in external libraries
The search text can be followed by: LineNumber to navigate to a line, such as input text: MAINACTI:20 will then locate the 20 lines of mainactivity
• Search for attributes (member and static, whether private or not) in the current project Cmd+option+o
Once again, search results can contain classes that are not in project
• Action (i.e., ctrl+1 on win-eclipse) as in Eclipse 1: option+?enter quick fix
That is alter+enter (you need to move the cursor to the semicolon before it can be in the contents of the code, when the code line is marked red)
• As in eclipse? o (View current class members): CMD+F12, show internal members
? I show/Fetch messages anonymous class
The F12 display inherits from the parent class, the member of the parent interface
• Select the method that can override (override) or implement (implement): Ctrl+o) as in eclipse?? G, where the lookup method is used: Option+f7) cursor in the method name of the calling interface method, view the interface method implementation class: Cmd+option+b or Cmd+option+click) Surround with:if, while, Try-catch , synchronized, et cetera: cmd+option+t) refactoring panel: ctrl+t) Remove invalid references: Ctrl+option+o) collate code and remove invalid references: Cmd+option+l) Find and replace: Cmd+f,cmd+r in After finding, use Cmd+g to navigate to the next text find in path with Replace in path:cdm+? F,cmd+? R.) Case conversion: Cmd+? U
•) Rename:? F6
• Cursor wrapping: cmd+?? • Add a row to the current line, and the cursor is positioned at the beginning of the row: cmd+?? • Copy entire line: cmd+d) Delete entire line: Cmd+delete) cut, cut entire line if no text is selected: cmd+x
• View doc/documentation notes: F1
• Navigate to unused claims F2
Android Studio shortcut keys for Mac OS X 10.5+