"Android Studio Shortcut" Import the corresponding package declaration (import packages)

Source: Internet
Author: User

from:http://blog.csdn.net/hyr83960944/article/details/38438355

It's possible to import a single declaration shortcut key everyone is easy to find, Alt+enter. But if I want all the declarations in the import file at once, what is this shortcut key, looking for, is not found, previously in Eclipse is ctrl+1, but after finishing Keymap does not work. In fact, I did not find, I guess there is no shortcut key, of course, if there is this shortcut key, found, I will update the next. Why I guess I don't have this shortcut, because Android Studio has an auto import feature in its settings.

About auto Import settings There are several, estimated that many people look also Meng, my side explained, if I explain you still do not understand, then you do not have to control what it is to do, directly hook on the good. Such as:

Explain it individually:

Xml

    • Show Import Popup, which is used for editing XML, automatically pops up an import dialog box asking if you need to import.

Java

    • Insert Imports on paste: (All Ask None), which is actually an option for you to ask for an imported package when you copy the code.
All: When you choose this item, you paste the code, there is the need to import the package name, will automatically import, do not play the prompt box ask: Select this when you paste the code, there is a need to import the package name, will play the prompt box, ask you want to import None: Select this item when you paste the code, When you need to import a package name, the prompt box does not bounce and is not imported automatically.
    • Show Import Popup: This is different from the above insert imports on paste. Ha, don't mix, this means that when the declaration of the class you entered is not imported, a selection dialog box pops up. But this is a bit of a problem to note here. Whether you check or not, anyway, the dialog box will not pop out, after you lose the class name, the declaration is automatically imported. So I guess this could be a bug in Android studio.
    • Optimize imports on Fly: This is actually the same as the shortcut key Ctrl+shift+o/ctrl+alt+o, which is to remove the unused declarations.
    • Add unambiguous imports on the fly: This is the automatic import function, when you enter the class name, the declaration is automatically imported.
    • Exclude from Import and completion: This is actually your custom Import. You don't have to pay attention, generally you can't use it.

"Android Studio Shortcut" Import the corresponding package declaration (import packages)

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.