为什么Google调用前缀为"m"的变量?

ip6*_*696 3 android

为什么Google会调用前缀为"m"的变量,例如:

    private int mSectionResourceId;
    private int mTextResourceId;
Run Code Online (Sandbox Code Playgroud)

我在所有的例子中看到了它.但我不明白为什么他们这样做?

现在我有一些实例非常好的例子.如果一个没有前缀的被调用的变量,我需要写

public SimpleSectionedRecyclerViewAdapter(Context context, int sectionResourceId, int textResourceId,
                                              RecyclerView.Adapter baseAdapter) {
        this.sectionResourceId = sectionResourceId;
        this.textResourceId = textResourceId;
Run Code Online (Sandbox Code Playgroud)

但如果我使用前缀我可以写

public SimpleSectionedRecyclerViewAdapter(Context context, int sectionResourceId, int textResourceId,
                                              RecyclerView.Adapter baseAdapter) {

        mSectionResourceId = sectionResourceId;
        mTextResourceId = textResourceId;
Run Code Online (Sandbox Code Playgroud)

我觉得它更具可读性.谁能向我解释一下前缀的优缺点?

Mar*_*rko 6

m开头的变量告诉你它们是你班级范围内的变量.班级成员.

链接到Android代码风格指南