Intellij (Android studio) member variable prefix

后端 未结 5 1481
情深已故
情深已故 2020-12-07 14:27

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

         


        
相关标签:
5条回答
  • 2020-12-07 14:46

    You need go to Setting > Editor > Code Style > Java and just specify s-prefix in static field, then click OK

    0 讨论(0)
  • 2020-12-07 14:52

    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

    0 讨论(0)
  • 2020-12-07 14:56

    In AS 2.2.1:

    File > Settings > Editor > Code Style> Java > Code Generation > Naming > Name Prefix Field / Name Prefix Static Field

    0 讨论(0)
  • 2020-12-07 15:01

    Try going to File-->Other Settings-->Default Settings. Your should be able to make prefixes for every other project that you do if you change prefix settings with the scheme set to default instead of Project. The prefix change would be in Java and Code Generation. That will fix setters and getters.

    0 讨论(0)
  • 2020-12-07 15:01
    1. Open Android Studio's preferences (from the Android Studio menu on Mac and from File -> Settings on Windows and Linux).
    2. Expand Editor and then expand Code Style.
    3. Select Java, then choose the Code Generation tab.
    4. In the Naming table, select the Field row and add m as the name prefix for fields. Then add s as the name prefix for static fields.

    1. Click Ok
    0 讨论(0)
提交回复
热议问题