What is the shortcut to Auto import all in Android

2019-01-01 06:24发布

Is there any way of auto importing (like in Eclipse Shift+Ctrl+O) in Android Studio?

I have found only Ctrl+Alt+O which ask for each thing, and I have to press Alt+Enter to accept it.

No way to do it faster?

11条回答
浮光初槿花落
2楼-- · 2019-01-01 06:26

In the Latest Version of Android Studio, the options for Auto-Import is enabled by default, so kudos no need to worry about that.

On Windows: If for some reasons auto-import is not enable you can go to settings by typing shortcut: Ctrl+Alt+S.

In the Search term just type 'Auto-Import' and then select 'Add unambiguous Imports on the fly' and click Ok.

That's it. You are Done. SnapShot of Auto_import

查看更多
旧人旧事旧时光
3楼-- · 2019-01-01 06:27

By changing the keymaps settings you can use the same keyboard short cuts as in Eclipse (Or your favourite IDE)

File -> Settings -> KeyMap

Android Studio -> Preferences -> KeyMap (Mac)

Change keymaps settings to eclipse so that you can use the short cut keys like in eclipse. For those who just want to change this one setting, it is

Main Menu -> Code -> Optimize Imports...

enter image description here

查看更多
千与千寻千般痛.
4楼-- · 2019-01-01 06:27

You can make short cut key for missing import in android studio which you like

  1. Click on file Menu
  2. Click on Settting
  3. click on key map
  4. Search for "auto-import"
  5. double click on auto import and select add keyboard short cut key
  6. that's all

enter image description here

enter image description here

enter image description here

Note: You can import single missing import using alt+enter which shown in pop up

enter image description here

查看更多
明月照影归
5楼-- · 2019-01-01 06:31

Note that in my Android Studio 1.4, Auto Import now under General

(Android Studio --> Preferences --> Editors --> General --> Auto Import)

enter image description here

查看更多
浮光初槿花落
6楼-- · 2019-01-01 06:35

Android Studio --> Preferences --> Editors --> Auto Import

  • Checked Optimize imports on the fly option
  • Checked Add unambiguous imports on the fly option
  • Click Apply and OK button.
查看更多
孤独总比滥情好
7楼-- · 2019-01-01 06:37

These are the shortcuts used in Android studio

Go to class CTRL + N
Go to file CTRL + Shift + N
Navigate open tabs ALT + Left-Arrow; ALT + Right-Arrow
Look up recent files CTRL + E
Go to line CTRL + G
Navigate to last edit location CTRL + SHIFT + BACKSPACE
Go to declaration CTRL + B
Go to implementation CTRL + ALT + B
Go to source F4
Go to super Class CTRL + U
Show Call hierarchy CTRL + ALT + H
Search in path/project CTRL + SHIFT + F

Programming Shortcuts:-

Reformat code CTRL + ALT + L
Optimize imports CTRL + ALT + O
Code Completion CTRL + SPACE
Issue quick fix ALT + ENTER
Surround code block CTRL + ALT + T
Rename and Refractor Shift + F6
Line Comment or Uncomment CTRL + /
Block Comment or Uncomment CTRL + SHIFT + /
Go to previous/next method ALT + UP/DOWN
Show parameters for method CTRL + P
Quick documentation lookup CTRL + Q
Delete a line CTRL + Y
View declaration in layout CTRL + B

For more info visit Things worked in Android

查看更多
登录 后发表回答