Member variable prefix (“m”) in getters and setters in Android studio 1.1

血红的双手。 提交于 2021-01-27 00:34:06

问题


How do I configure Android Studio "v 1.1" to correctly generate getters and setters for member variables with prefixes and not to generate getters like: getmName() and instead generate getName()?

I've looked at many questions like : Intellij (Android studio) member variable prefix, but it seems to be removed in "Version 1.1"

Am i right?


回答1:


in preferences -> code style -> java you'll find the tab code generation. There you will find a matrix of text box, where you can define prefix and suffix for field, static field, parameter and local variable. Enter m for the pair (Name Prefix, Field) and it should work

enter image description here




回答2:


Editor->Code Style->Java, then last tab 'Code Generation'

write m in field's 'Name Prefix' column.




回答3:


You must to use names without 'm' in start all private values.

http://jakewharton.com/just-say-no-to-hungarian-notation/



来源:https://stackoverflow.com/questions/30070139/member-variable-prefix-m-in-getters-and-setters-in-android-studio-1-1

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