Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
129 views
in Technique[技术] by (71.8m points)

java - Intellij (Android studio) member variable prefix

How do I configure Android Studio (or Intellij generally) to correctly generate getters and setters for member variables with prefixes?

If I have a class

public class Foo{
    int mBar;
}

I want it to create getBar() instead of getMBar when I do Refactor->Encapsulate or Generate

EDIT

I found the way to do it per-project basis: You just go File->Settings->Project Settings->Code Style

But it created a settings file somewhere in my project directory.

I want a solution which allows me to do it once for all projects, present and future.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

In Mac OS

  • Android Studio -> Preferences -> Code Style -> Java
  • on the right panel, click on the right arrow until you see code generation tab
  • Click ok

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...