多人协同开发最好是统一一下代码风格,比如 if语句的花括号是不是紧接着放到if(xx)后面。有些规范是单独将{放到一行的。
java->import scheme ->intellij IDEA code style XML
指定需要导入的xml
之后格式化代码就能达到xml所规定的代码风格了
ctrl + A 全选代码后,点击 code-> reformat code
贴下GoogleStyle.xml
xmlns:android
^$
xmlns:.*
^$
BY_NAME
.*:id
http://schemas.android.com/apk/res/android
style
^$
.*
^$
BY_NAME
.*:.*Style
http://schemas.android.com/apk/res/android
BY_NAME
.*:layout_width
http://schemas.android.com/apk/res/android
.*:layout_height
http://schemas.android.com/apk/res/android
.*:layout_weight
http://schemas.android.com/apk/res/android
.*:layout_margin
http://schemas.android.com/apk/res/android
.*:layout_marginTop
http://schemas.android.com/apk/res/android
.*:layout_marginBottom
http://schemas.android.com/apk/res/android
.*:layout_marginStart
http://schemas.android.com/apk/res/android
.*:layout_marginEnd
http://schemas.android.com/apk/res/android
.*:layout_marginLeft
http://schemas.android.com/apk/res/android
.*:layout_marginRight
http://schemas.android.com/apk/res/android
.*:layout_.*
http://schemas.android.com/apk/res/android
BY_NAME
.*:padding
http://schemas.android.com/apk/res/android
.*:paddingTop
http://schemas.android.com/apk/res/android
.*:paddingBottom
http://schemas.android.com/apk/res/android
.*:paddingStart
http://schemas.android.com/apk/res/android
.*:paddingEnd
http://schemas.android.com/apk/res/android
.*:paddingLeft
http://schemas.android.com/apk/res/android
.*:paddingRight
http://schemas.android.com/apk/res/android
.*
http://schemas.android.com/apk/res/android
BY_NAME
.*
http://schemas.android.com/apk/res-auto
BY_NAME
.*
http://schemas.android.com/tools
BY_NAME
.*
.*
BY_NAME