File -> Settings -> Editor -> General -> Anto Import 勾选 Optimize imports on the fly (移除无用的声明) 勾选 Add unambiguous imports on the fly (自动导入声明) Android Studio设置自动导包.png