Android Studio often uses the manual

Source: Internet
Author: User
Tags log log

      • Use small operations frequently
        • Word selection
        • Files that show recent action changes
        • File Lookup
        • Operation Record
        • Move Line
        • Find method call at
        • Methods of follow-up
        • Show the parameters of the method
        • High-speed operation of the line
        • Multi-line operation
        • High-Speed completion complete
        • Code hints
        • High-speed operation of variables
        • Code Folding
        • Preview method definition
        • Paste Board Management
        • Split form
        • Variable naming style
        • View outline
        • Bookmark
      • High-speed reconfiguration
        • Refactoring Portal
        • Surround With
        • Extract
        • Code templates
      • Code Analysis
        • Inspect Code Code Cleanup
        • Dependencies
        • Method Call Stack
      • Breakpoint Debugging
        • High-speed breakpoints
      • Shortcut key Lookup table

Often use small-action word selection

The General IDE through the OPTION + arrow key around (win for Ctrl + LEFT and RIGHT arrow keys) on the cursor to the beating of words, but because we use the camel name more, the default will result in a number of words of the hump-style jump. Fortunately as is able to set this style.

Default effect

The effect after the change

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvc2luyxrfmzu3njiwndc=/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma== /dissolve/70/gravity/southeast "alt=" here to write a picture descriptive narrative "title=" ">

Change steps

Open Preferences Slice settings

Although the word is jumping, but when you want to copy the variable name double-click. Only one word in the variable name is copied. Instead of a complete string like a space cut that would have been copied on both sides. Anyway, I used a little less than a day to switch back to the original style.
But option + left and RIGHT arrow keys this little trick is cooked, than deliberately with the mouse point, or the cursor down to move to the target location will be very efficient very much.

Show recent actions, changes to the file

For example: I opened the main_activity.xml layout file and then closed the page. This time command + E, will be shown below for example the previous action file.

So suppose you want to see the previously changed files, Command + Shift + E. Ability to switch to high-speed interface with control + TAB.

Shortcut keys

Recent operations
Command + E (MAC)
CTRL + E (WIN)
Recent Changes
Command + Shift + E (MAC)
CTRL + SHIFT + E (Win)

File Lookup

Search Everywhere

Global Find feature file feature in Project

Find class file

Command + O (MAC)
CTRL + N (Win)

The default is simply to find the class file in your project code, assuming you need to find the relevant class in the SDK or class library. Press the shortcut key again, or tick the option to search for the global class file

Find Files

This level is wider than the one above. Contains all files, such as XML.

command + shift + o (mac)ctrl + shift + n (win)

If you need to search for a class library or source code, either press the shortcut key once, or tick the Find class to give the option in the diagram.

Operation Record

When browsing the code structure, there are often many classes that are always followed up, assuming that you want to go back to the point of view. Then you have to remember this shortcut.

    • Command + Option + left\right or COMMAND + [, COMMAND +] (MAC)
    • CTRL + ALT + Left\right (win)
Move Line

This does not have too much introduction, is the whole line of moving up and down.

Option + shift + 方向键上\方向键下 (mac)alt + shift + 方向键上\方向键下 (win)
Find method call at

Scenario: Find out where a method is called, or where an ID is referenced. Select this method to right-click on find usages.

Shortcut keys:

option + F7 (mac)alt + F7 (win)
Methods of follow-up

Methods are always accompanied by a twist, and we always look at the details inside the method. The usual way to do this is to hold command and click on the method name.

It is also possible to conduct internal follow-up of the method directly at the cursor location via command + B.

Command + B (mac)ctrl + alt + B (win)
Show the parameters of the method

When we use a method, we show the full number of references at the beginning of the start. But it may not exist in a while. At this point, let's say you want to know what the next parameter is, or see the full number of references.

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvc2luyxrfmzu3njiwndc=/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma== /dissolve/70/gravity/southeast "alt=" here to write a picture descriptive narrative "title=" ">

Shortcut keys:

command + P (mac)ctrl + P (win)

Suppose you also want to look at the document of the method, do not follow the source code, directly F1 the key to display the document.

High-speed operation of the line

Delete rows at high speed, in fact using the Cut function to command + X

High-speed copy line with COMMAND + DMAC, CTRL + Dwin

Multi-line operation

There may be times when we declare that a series of related variables are of type float, but the real need is the int type. At this point, multiple choices can be made for overall changes. For example, with:

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvc2luyxrfmzu3njiwndc=/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma== /dissolve/70/gravity/southeast "alt=" here to write a picture descriptive narrative "title=" ">

Press and hold option (Win is ALT) and then mouse over the selection of the area. Then make the appropriate changes to it.

You may think that the above must be a continuous talent enough. So suppose you can set multiple cursor points to meet your problem?

See:

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvc2luyxrfmzu3njiwndc=/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma== /dissolve/70/gravity/southeast "alt=" here to write a picture descriptive narrative "title=" ">

OPTION + SHIFT + mouse click (MAC)
ALT + SHIFT + mouse click (Win)
You can add an edit cursor. Finally, assume that you don't need to ESC to turn off the extra cursor.

High-Speed completion complete

Creates an object. or Findviewbyid () sometimes need to move the mouse or the cursor to the end of the semicolon to complete the completion. All of these are quick keys to fix. When you use the habit, it will be very convenient and useful.

command + shift + enter(mac)ctrl + shift + enter(win)

Features implemented

    • Method body curly braces are added
    • Join the line end semicolon
    • Take the initiative to format the change operation, etc.
Code hints

Code hints that can be paged out wherever they are.

CONTROL + OPTION +/(not default, Mac defaults to control + space). What we're going to say here is. After the code hints, it is usually OK to enter the key. When you press the ENTER key. The content after the cursor is preserved. When sometimes we don't need to. At this point you will be able to use the table key to select. It will erase the input from the following.

Win Shortcut CTRL + SPACE (win same most and input method conflict, please manually in as settings inside Keymap item Find completion Basic manual change shortcut key)

High-speed generation of variables

For example, in the method body Logi direct high-speed generation of a log log output template, but tag this constant has not been declared. This time use the cursor to move to the tag. You can generate them at high speed by using shortcut key hints.

optionenter(mac)enter(win)
High-speed operation of variables


Two shortcuts were used,

First: Jump to the declaration of a variable

    • Command + B (MAC)
    • CTRL + B (Win)

Second time: Jumps to the definition of the variable type

    • Command + SHIFT + B (MAC)
    • CTRL + SHIFT + B (Win)
Code Folding

Collapses and expands a block of code.

    • Command + PLUS sign \ Minus (MAC)
    • CTRL + PLUS sign \ Minus (win)
Preview method definition

Suppose you just want to understand the definition of a method in general, without the jump display of the source code class where the method resides. Ability to preview with Command + Y (win shortcut key CTRL + SHIFT + I)

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvc2luyxrfmzu3njiwndc=/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma== /dissolve/70/gravity/southeast "alt=" here to write a picture descriptive narrative "title=" ">

Paste Board Management

For copy-paste. We're used to just a single c+v, so let's say you want to see the copied content that was previously overwritten. As same as have copy pasteboard to manage. Displays recent copies of the content.

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvc2luyxrfmzu3njiwndc=/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma== /dissolve/70/gravity/southeast "alt=" here to write a picture descriptive narrative "title=" ">

    • Command + SHIFT + V (MAC)
    • CTRL + SHIFT + V (win)
Split form

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvc2luyxrfmzu3njiwndc=/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma== /dissolve/70/gravity/southeast "alt=" here to write a picture descriptive narrative "title=" ">

You just need to right-click on the tab page. Select Split Vertical\horizontal.

Variable naming style

For member variables it should start with M. For static members, it is generally the beginning of S. This style can be set in this way.

This way, when you enter the name of a variable, you will be able to make an active complement to M or S. At the same time, when the code is extra, the generated code can be reconstructed on its own initiative according to this rule.

View outline

When a class is very large. You can open the outline interface by command + F12 (win for CTRL + F12). Displays a list of all methods and member variables.

And fuzzy search is supported. To filter the display. Ability to find the set of methods to search at high speed.

Bookmark

When browsing large code, or debugging. Sometimes you may need to remember some key code or methods. You can use bookmarks at this time. To record this critical code. Just click on the line you need to mark and press F3 to make a small tick on the left side. This means that a bookmark has been played.

At the same time in the favorites tag, you can also find the corresponding bookmarks

The bookmark panel can be pulled up by shortcut command + F3 (win for SHIFT + F11), and may be manipulated.

High-speed reconstruction reconstruction Portal

When a code fragment is ready for refactoring. You can use Control + t (win for CTRL + ALT + SHIFT + T) to open the refactoring portal. or right-click to select Refactor to display the refactoring interface.

There are a lot of handy features here. Commission method and so on.

Surround With

When a piece of code is carried out, the condition wraps, catches the exception, loops, runnable, etc. Ability to directly use shortcuts without the need to manually generate conditions in the code block copy-paste

Shortcut keys

    • Command + OPTION + T (MAC)
    • CTRL + ALT + T (win)
Extract

You can often use it to extract a method.

Not only that, you can also extract the same properties for multiple controls in XML as a style

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvc2luyxrfmzu3njiwndc=/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma== /dissolve/70/gravity/southeast "alt=" here to write a picture descriptive narrative "title=" ">

Isn't that really cool?

This is one of the only possible means for XML to extract style and to extract layout layouts

In the code, you can extract various variables, parameters, and galleries.

Code templates

As has built up a lot of code templates, you can be very recite before the end of the code. For example, the following small

Use the shortcut keys to bring up these code templates

    • Command + J (MAC)
    • CTRL + J (WIN)
Code Analysis

Google offers a lot of code analysis tools that are concentrated in the analyze of the top menu bar.

Inspect Code & Code cleanup

Inspect code enables the IDE to analyze the entire project. Similar to lint analysis, and will give a general change of opinion, etc.

The Code cleanup feature is capable of doing its own proactive coding repair.

Dependencies

Through several dependencies options in the Analyze. Ability to analyze project dependencies at high speed.

Method Call Stack

For some methods, it is important to look at where it is called and in the order in which it is called. The method call stack can be found by using the control + OPTION + H high speed.

Breakpoint debugging high-speed breakpoint

Conditional breakpoint. Mainly used in the circulation body. A for that loops 10 times. Just want to enter the breakpoint at the 8th time.

Like a normal breakpoint, declare a breakpoint first. Then right-click on the normal breakpoint. In the popup menu, fill in the breakpoint conditions can be. For example, the following:

In the figure above, enable enables you to control whether a breakpoint is enabled or disabled.

A temporary breakpoint. Suppose you need a breakpoint that runs only once. The breakpoint itself is canceled after the run is finished. You can then use the shortcut point to make the current row a temporary breakpoint.

    • Command + OPTION + SHIFT + F8
    • CTRL + ALT + SHIFT + F8

For the length is not very long, the debugging section is affixed with a very specific post that explains

    • Android Studio Code Debugging Daquan
Shortcut key Lookup table
Narrative of functional description keymap corresponding name Mac Win Linux
Tips on how to resolve errors Show Intention Actions OPTION + Enter ALT + ENTER
As Configuration Interface Preferences Command +, Control+alt+s
Project item Configuration Interface Project Structure COMMAND +; Control+alt+shift+s
High-speed component code Code Generate Command + N ALT + Insert
Code hints Completion/basic Control + space (Mac conflicts, manual changes) CTRL + SPACE (win same most and input method conflict, manual change)
Select View Select in any view OPTION + F1 ALT + F1
Add Bookmark ID Toggle Bookmark OPTION + F3 CTRL + F11
Move down one line Move line Down OPTION + SHIFT + Down ALT + SHIFT + Down
Move up one line Move line up OPTION + SHIFT + up ALT + SHIFT + UP
Gaze code Comment with Line Comment Command +/ CTRL +/
Wrapping code with Code templates Surround with Live Template Command + OPTION + J CTRL + ALT + J
Formatting code Reformat Code Command + OPTION + L CTRL + ALT + L
Copy Reference Copy Reference Command + OPTION + SHIFT + C CTRL + ALT + SHIFT + C
If/try and other parcel codes Surround with. Command + OPTION + T Ctrl + ALT + T
View claims Declaration Command + B CTRL + B
Quickly copy rows down Duplicate Line or Block Command + D CTRL + D
Delete Row Delete Line Command + DELETE CTRL + Y
Quick Recent Open Recent Files Command + E CTRL + E
Find Edit/find/find Command + F CTRL + F
File method Structure File Structure Command + F12 CTRL + F12
Show bookmarks Show Bookmarks Command + F3 SHIFT + F11
Code highlighting down search Move to Next Occurrence Command + G F3
Code highlighting up find Move to Previous occurrence command + SHIFT + G SHIFT + F3
Generate code according to template Insert Live Template Command + J CTRL + J
Navigate to Row Navigate/line Command + L CTRL + G
High speed to beginning/end Move Caret To Line Start/end Command + left/right CTRL + Left/right
Code Collapse/Expand Collapse/expand Command + minus/Plus CTRL + Minus/Plus
Find class Navigate/class Command + O CTRL + N
MultiRow Gaze Code/comment Command + OPTION +/ CTRL + ALT +/
Formatting code Reformat Code Command + OPTION + L CTRL + ALT + L
Hint type of participation Parameter Info Command + P CTRL + P
Find replacements Replace Command + R CTRL + R
Find command Find Action Command + SHIFT + A CTRL + SHIFT + A
Copy file path Copy Paths Command + SHIFT + C CTRL + SHIFT + C
Moving code blocks Move Statement Up/down Command + SHIFT + Down/up CTRL + SHIFT + Down/up
Code completion Complete Current Statement Command + SHIFT + ENTER CTRL + SHIFT + ENTER
Full path Lookup Find in Path Command + SHIFT + F CTRL + SHIFT + F
Code highlighting Highlight Usages in File Command + SHIFT + F7 ALT + J
All code in form collapse/expand Collapse/expand All Command + SHIFT + minus/Plus CTRL + SHIFT + minus/Plus
Find Files Navigate/file Command + SHIFT + O CTRL + SHIFT + N
Replace in full path Replace in Path Command + SHIFT + R CTRL + SHIFT + R
Uppercase and lowercase conversions Toggle case Command + SHIFT + U CTRL + SHIFT + U
Show pasted version history Paste from the history Command + SHIFT + V CTRL + SHIFT + V
High-speed Lookup definition Command + Space CTRL + SHIFT + I
Paste Paste Command + V CTRL + V
Copy Copy Command + C CTRL + C
Remove Invalid package references Optimize Imports Control + OPTION + O CTRL + ALT + O
Show class relationship inheritance system Type Hierarchy Control + H CTRL + H
High-Speed Overwrite method Override Methods Control + O CTRL + O
Find the location of the call Call Hierarchy Control + OPTION + H CTRL + ALT + H
Add Bookmark Toggle Bookmark F3 F11
Expand Narrow Selection Extend Selection/shrink Selection OPTION + Up/down CTRL + W + SHIFT + W
Jump to Parent class Super method Command + U CTRL + U
Close the current tab tab Editor Tabs/close Command + W CTRL + SHIFT + A
Close the rest of the form except the edit form Hide all Tool Windows Command + SHIFT + F12 CTRL + SHIFT + F12
Preview method definition Quick Definition Command + Y CTRL + SHIFT + I
Returns the last edit position of the cursor Last Edit location Command + SHIFT + DELETE CONTROL + SHIFT + Backspace
Transfer to code block header/Tail Move Caret to Code Block Option + Command + [or] control+[or]
Renaming Rename SHIFT + F6 SHIFT + F6
Extraction method Extract Method Command + OPTION + M Control+alt+m
Extracting variables Extract Variable Command + OPTION + V Control+alt+v
Extracting fields Extract Field Command + OPTION + F Control+alt+f
Extracting constants Extract Constant Command + OPTION + C Control+alt+c
Extract the number of references Extract Parameter Command + OPTION + P Control+alt+p
Refactoring Portal Refactor this Control + T CTRL + ALT + SHIFT + T

Android Studio often uses the manual

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.