From Eclispe to Android Studio, you need to know the shortcut keys (AS how to modify the shortcut keys), eclispeandroid

Source: Internet
Author: User

From Eclispe to Android Studio, you need to know the shortcut keys (AS how to modify the shortcut keys), eclispeandroid

    • Quick notes
    • Shortcut Builder
    • Mouse prompt
    • Quick Search for the next same variable
    • Code prompt shortcut
    • Line comment shortcut
    • Hierarchy hierarchical observer
    • QAndroid Studio does not automatically prompt that the Code Completion fails to automatically detect the error

1. Quick notes

Quick notes (custom shortcut key Command + Shift + J)

In Eclispe, "Alt + Shift + J" can quickly generate comments for [functions/member variables/classes], which is very convenient. (If you do not know how to try it !) -Click "view results-

This function is also available in Android Studio. There is no shortcut key by default. We can set it by ourselves (I used to set it to the same location as Eclispe, set Mac to "Command + Shift + J ").

How to change the shortcut keys in Android Studio)

The following is an example for Mac:
Open Android Sudio-> Preference, search for Keymap in the search bar, and search for [Fix doc comment] In the right search bar]

Click the "fix doc comment" option and select "Add Keyboard Shortcut"

At the cursor position in the first line of the newly opened interface, press the keyboard shortcut key you want to combine (for example, my "Command + Shift + J "), observe that the "No conficts" column in the Conflicts column indicates that there is No conflict with other shortcut keys. Click OK.

At this time, the "fix doc comment" column is marked with a yellow shortcut key.

PS: other shortcut keys are in Keymap. You can use the above method to change them to your own habits.

After the modification, the effect (a document comment is generated quickly ):

2. Quick Builder

Shortcut Builder (Ctrl + Enter or Command + N)

There are many method generators in Eclispe, such as constructor, which member variables can be selected, getter and setter can quickly generate access methods for member variables, and so on.

Use the shortcut key "Ctrl + Enter" or "Command + N" (in Mac) to quickly display the generator shortcut interface.

We can see that the first is the constructor, the second to the fourth is the accesser, and the interpreter (toString (), Override Methods, and so on.

There is a tip when you select setter. In the "template" option bar above, setter can select Builder

In this way, the generator will return this type of instance. The advantage is that it can be set as a continuous parameter.

    test.setTest1(1).setTest2(2).setTest3(3);

We can see that the FragmentTransaction In the Android source code has similar usage:

    FragmentTransaction ft = getFragmentManager().beginTransaction()    .add(R.id.content, mFragment)    .commit();

Far away ~

3. Mouse prompt

Placing the mouse over the class code in eclipse automatically displays the class information,
Android Studio does not automatically prompt when you use it.

By default, Android Studio does not move the mouse over a class, method, or variable like Eclipse. A floating box is displayed, showing relevant documents. However, Android Studio can implement this function through configuration.

Procedure:
[Mac] Android Studio-> Preference-> Editor-> General-> on the right, find the title "Other" Bar-> check export Show quick doc on mouse move Delay (MS)

:

For details about this section, see "show mouse tips for Android Studio" (if you cannot find the above path, you can see whether the path in the reference document is feasible)

4. Quickly search for the next same variable

Quickly find the next same variable (Ctrl + K/Command + K)

In Eclipse, if you select a variable and press Ctrl + K, the cursor automatically locates where the Next variable is used. The shortcut key name is "Find Next ".

Based on the custom shortcut key learned in step 1, we can go to Keymap to Find [Find Next]

You can see that the default shortcut key is Command + G. You can change it to the same shortcut key as that used in Eclispe. Note that the shortcut key conflict should be avoided during modification.

5. Code prompts shortcut keys

Code prompt shortcut key (custom Command + /)

In Eclipse, there is a code prompt shortcut: Alt +/; the shortcut key name is Content Assist. In Android Studio, replace "Class Name Completion" with the shortcut key Ctrl + Alt + Space (Space key ).

Search for Class Name Completion in Android Sudio-> Preference-> Keymap and change it to Command +/

PS: the default Command +/is a line comment (for example, 6). If there is a conflict, you can modify it by 6 first.

For more information, see [Android Studio Shortcut Keys].
Extended reading: how to set Automatic code prompt for Android Studio

6. Line comment shortcut

Line comment shortcut key (custom: Ctrl + /)

Search for [Comment with Line Comment] In Android Sudio-> Preference-> Keymap. The default value is "Command +/". Change the shortcut key to "Ctrl + /"

7. Hierarchy hierarchical observer

Hierarchy hierarchical observer (Ctrl + H)

Hierarchy is particularly useful! The default shortcut is Ctrl + H (in Mac), or Navigate to> Type Hierarchy on the menu bar.

Where can I give an example? For example, I am reading Context (I recommend a Context-based article titled What is Android Context?) ) To view all its inheritance structures. First, I can locate the Context class (press Ctrl + LEFT MOUSE TO ENTER), and then press Ctrl + H to bring out the Hierarchy toolbar, then I can see all the classes that inherit the Context and the classes that inherit the Context!

Pay attention to the three buttons in front of you. The first is to look at the parent class and subclass of the current class, the second is to look at only the parent class, and the third is to look at only the Child class.

Q: Why does Android Studio not automatically prompt Code Completion or automatic check error?

A: remove the check box before File-> Power Save Mode.

The reason for the failure is that the AS is set to the power-saving mode. If it is set to the power-saving mode, the AS will disable some auxiliary functions for power-saving purposes. So the code prompt is disabled.

/***** Zookeeper, Zookeeper, And the development zone are currently under development. ************************************************** when * too many characters * too many nonsense words, it is a bit like * too many characters, too many characters, and too many characters. please refer to the following link for more information: */

Copyright Disclaimer: This article is an original article by the blogger. For more information, see the original article address and author (Alibaba ).

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.