Reputation: 16687
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.*
Is there a way to keep auto-import on but tell it to not do that, or change the threshold? I don't mind having a long list of imports, it feels... familiar.
Upvotes: 13
Views: 5213
Reputation: 3278
The Android Kotlin Style Guide says:
Wildcard imports (of any type) are not allowed.
You can set your Android Studio preferences to remove all wildcard imports from Kotlin files.
Editor > Code Style > Kotlin
Use single name import
for Top-level SymbolsUse single name import
for Java Statics and Enum Members-
symbol until it says Nothing to show
Upvotes: 8
Reputation: 3075
You can set this under the Kotlin "Code Style" section in Preferences:
Upvotes: 21