Kotlin: Why are most variables underlined in Android Studio and how do I turn that off?

笑着哭i 提交于 2019-12-03 19:15:44

问题


I wanted to know why most variables in Kotlin are underlined. Some files contain a lot of underlining which is very annoying. If I hover my mouse over a variable it doesn't give any information most of the time. But on some it says "This property has a backing field" or "Value captured in a closure". Does anybody know how to disable those underlines? Here is a screenshot with what I mean:

And realm is then underlined throughout the entire file.


回答1:


It's just Editor Preferences.

Edit:

This is moved to

Preferences -> Editor -> Colors & Fonts -> Kotlin -> Properties and Variables

Thanks rmirabelle for the comment

For the old plugin, you can go to

Preferences -> Editor -> Colors & Fonts -> Kotlin

Then find Var (mutable variable, parameter or property) and remove Underscored effect.

I guess they just try to discourage using var by adding the annoying underscored. :P




回答2:


In Android Studio 3.1.2 this has been moved to -

Settings > Editor > Color Scheme > Kotlin



来源:https://stackoverflow.com/questions/34963949/kotlin-why-are-most-variables-underlined-in-android-studio-and-how-do-i-turn-th

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!