1. 程式人生 > >IDEA自動/手動導包

IDEA自動/手動導包

1.進入設定,File->Settings,或者快捷鍵Ctrl+Alt+S

2.Editor→General→Auto Import 

3.選中Optimize imports on the fly和Add unambiguous imports on the fly,點選apply 和OK鍵

Optimize imports on the fly : 自動去掉一些沒有的包

Add unambiguous imports on the fly : 自動幫我們優化匯入的包

4.如果沒有設定自動匯入包的功能,可以用Alt+Enter 快捷鍵來手動匯入包。