I noticed that for up to 4 imports from the same package, auto-import will simply append the import in the list:

import android.support.v7.widget.AppCompatImageButton
import android.support.v7.widget.LinearLayoutManager
import android.support.v7.widget.RecyclerView
import android.support.v7.widget.Toolbar

But adding a 5th import will make auto-import switch to a wildcard:

import android.support.v7.widget.*

有没有一种方法可以保持自动导入,但告诉它不要这样做,或者更改阈值?我不介意有一长串进口商品,感觉.很熟悉.

推荐答案

You can set this under the Kotlin "Code Style" section in Preferences:

Imports

Kotlin相关问答推荐

在Kotlin中处理结果的高阶函数

使用数据存储首选项Kotlin Jetpack Compose

collectAsState 未从存储库接收更改

Java/Kotlin中类似Rust般的注释编译?

内容更改后的 var 重新计算

在 Kotlin 中,为什么在 `+` 之前但在 `.` 之前没有换行符?

Kotlin 中私有集的完整语法 struct 是什么?

Kotlin 从其他类调用成员扩展函数

如何使用 Android CameraX 自动对焦

retrofit 响应代码 405 并带有消息method not allowed here

在 Scaffold Jetpack Compose 内的特定屏幕上隐藏顶部和底部导航器

如何在 Kotlin 中判断数组类型(不是泛型类型)

更新到版本4.10.1/4.10.2后 Gradle 同步失败

在Kotlin中传递并使用函数作为构造函数参数

Android Jetpack导航,另一个主机片段中的主机片段

Kotlin中OnclickListener方法之间的差异

如果作为 RxJava Observable 提供,Kotlin 密封类子类需要强制转换为基类

使用 rxbinding 时我应该取消订阅吗?

使用 java lambda 调用 kotlin 函数时,Kotlin 无法访问 kotlin.jvm.functions.Function1

Kotlin反射不可用