android studio auto,在Android Studio中,自動導入的快捷方式是什么?

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

在Android Studio中是否有自動導入的方法(比如Eclipse Shift+Ctrl+O) ?

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

我只找到了Ctrl+Alt+O,要求每一件東西,我必須按Alt+Enter來接受它。

No way to do it faster?

沒辦法更快嗎?

11 个解决方案

#1

1154

For Windows/Linux, you can go to File -> Settings -> Editor -> General -> Auto Import -> Java and make the following changes:

對於Windows/Linux,你可以到文件->設置->編輯->通用->自動導入-> Java,並進行如下修改:

change Insert imports on paste value to All

將導入的導入粘貼到所有的值。

markAdd unambigious imports on the fly option as checked

在飛行選項中添加不確定的導入。

On a Mac, do the same thing in Android Studio -> Preferences

在Mac上,在Android Studio ->首選項上做同樣的事情。

1348c34b72c2a1907a425e26c7f512dd.png

After this, all unambiguous imports will be added automatically.

在此之后,將自動添加所有明確的導入。

#2

78

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

通過改變keymaps設置,您可以在Eclipse中使用相同的鍵盤快捷方式(或者您最喜歡的IDE)

File -> Settings -> KeyMap

文件->設置->鍵映射。

Android Studio -> Preferences -> KeyMap (Mac)

Android Studio ->首選項-> 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

將keymaps設置更改為eclipse,這樣您就可以使用像eclipse這樣的快捷鍵。對於那些只想改變這一設置的人來說,它是。

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

主菜單->代碼->優化導入…

c6ac32ef8f2dd5d5ddeb167fbe122cbe.png

#3

70

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

按CTRL + N鍵,按CTRL + Shift + N,打開選項卡ALT +左箭頭鍵;ALT +方向查找最近的文件按CTRL + E去行CTRL + G導航到最后編輯位置CTRL + SHIFT +退格去申報CTRL + B去實施CTRL + ALT + F4 B去來源去超類CTRL + U顯示調用層次結構按CTRL + ALT + H搜索路徑/項目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

重新格式化代碼CTRL + ALT + L優化進口CTRL + ALT + O代碼完成CTRL + SPACE問題快速解決ALT + ENTER圍繞代碼塊CTRL + ALT + T重命名和折射Shift + F6評論或取消CTRL + /塊注釋或取消CTRL + Shift + /去之前下一個方法ALT +上/下顯示參數方法CTRL + P快速查找文檔CTRL +刪除一行CTRL + Y在布局視圖聲明CTRL + B

更多信息請訪問Android操作系統。

#4

19

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

Android Studio——>偏好——>編輯——>自動導入。

Checked Optimize imports on the fly option

檢查優化導入的fly選項。

Checked Add unambiguous imports on the fly option

選中了在fly選項上添加明確的導入。

Click Apply and OK button.

單擊Apply和OK按鈕。

#5

8

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

注意,在我的Android Studio 1.4中,自動導入現在一般。

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

(Android Studio——>偏好——>編輯——> General——> Auto Import)

fc5bf6793f4bc7ef652f6bea655c17af.png

#6

5

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

您可以在您喜歡的android studio中做短切鍵來丟失導入。

Click on file Menu

點擊文件菜單

Click on Settting

點擊洞穴

click on key map

點擊鍵映射

Search for "auto-import"

搜索“auto-import”

double click on auto import and select add keyboard short cut key

雙擊自動導入,選擇添加鍵盤快捷鍵。

that's all

這是所有

c7b0d5e4e4550930a9ceb7f1b13cb1d0.png

cbbbffa2b5c8abd8c5204feb7e233318.png

8faa5d3882dac19b09fa67e22c0de941.png

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

注意:您可以使用alt+enter導入單個缺失的導入,顯示在彈出框中。

487eebf1e4309a630ba0b038b5b9a676.png

#7

5

On Windows, highlight the code that has classes which need to be resolved and hit Alt+Enter

在Windows上,突出顯示需要解決的類的代碼,並按Alt+Enter鍵。

#8

3

Go to File -> Settings -> Editor -> Auto Import -> Java and make the below things:

轉到文件->設置->編輯->自動導入-> Java,做以下的事情:

Select Insert imports on paste value to All

選擇Insert import on paste value to All。

Do tick mark on Add unambigious imports on the fly option and "Optimize imports on the fly*

在“fly選項”上添加不確定的進口,並“在飛行中優化進口?”

#9

2

For Linux (Ubuntu 14.04), you can go to

對於Linux (Ubuntu 14.04),你可以去。

File -> Settings -> Editor -> Auto Import

文件->設置->編輯->自動導入。

check all the boxes and insert all imports on paste.

檢查所有的方框,並將所有的導入粘貼。

aHR0cHM6Ly9pLnN0YWNrLmltZ3VyLmNvbS9wMlczTS5wbmc=

#10

1

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

在最新版本的Android Studio中,自動導入的選項是默認啟用的,所以kudos無需為此擔心。

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

在Windows上:如果出於某些原因,自動導入不能通過快捷鍵Ctrl+Alt+S進入設置。

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

在搜索項中只鍵入“自動導入”,然后選擇“在飛行中添加明確的導入”,然后單擊Ok。

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

就是這樣。你是做。的快照Auto_import

#11

0

File > Settings > Editor > General >Auto Import (Mac: Android Studio > Preferences > Editor > General >Auto Import).

文件>設置>編輯>通用>Auto Import (Mac: Android Studio > Preferences >編輯>通用>Auto Import)。

Select all check boxes and set Insert imports on paste to All. Unambiguous imports are now added automatically to your files.

選擇所有復選框,並將插入導入粘貼到所有。不明確的導入現在會自動添加到您的文件中。

參考

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值