Reputation: 797
IDE : Android Studio 3.3
I am doing kotlin smart casting in RecyclerView adapter on ViewHolder.
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
holder as ViewHolder
Now every mention of viewholder is being highlighted, with text on hover saying "Smart Cast to ..." This is not a problem but really annoying. How can I disable this highlight feature?
Upvotes: 15
Views: 1271
Reputation: 147961
In the IDE prefererences, see:
Editor → Color scheme → Kotlin → Smart-casts → Smart-cast value
If you want to disable value smart-cast highlighting, just uncheck Background.
You may want to configure the other kinds of smart-casts, too.
Upvotes: 19
Reputation: 1849
Instead of just using holder as ViewHolder
, try using if (holder !is ViewHolder) throw Exception()
or if (holder !is ViewHolder) return
.
Upvotes: 0
Reputation: 972
go to File -> Settings -> Editor -> Color Scheme -> Java/Kotlin -> Classes and Interfaces
You should be able to find color scheme for classes here. Hope it helps.
Upvotes: 1