-
Download the android-formatting.xml file
-
Open Eclipse and go to Window->Preferences->Java->Code Style->Formatter
-
Import theandroid-formatting.xmlfile and make sure “Android” is selected in the drop down list
-
In eclipse go to Window->Preferences->General->Editors->Text Editors
-
Check “Insert spaces for tabs” and make sure that “Displayed tab width” is 4
-
Check “Show print margin” and make sure that “Print margin Columns” is 100
-
Check “Show Whitespace characters” (如果不想显示空格的童鞋,可忽略这步)
-
In eclipse go to Window->Preferences->Java->Editor->Save Actions
-
Check “Perform the selected actions on save”
-
Check “Additional Actions” than hit configure
-
Under the “Code Organizing” tab check “Remove trailing whitespace” for all lines and “Correct Indention”
-
Under the “Code Style” tab remove all check marks
-
Under the “Missing Code” tab check everything
-
Now go to Window->Preferences->XML->XML Files->Editor
-
Check “Split multiple attributes each on a new line”
-
Check “indent using spaces” and make sure the value is set to 4
android代码格式化方法小结
最新推荐文章于 2025-10-10 05:25:17 发布
本文提供了一套详细的步骤来配置Eclipse IDE,以实现针对Android项目的代码格式化。这些设置涵盖了从导入特定的格式化文件到调整编辑器偏好设置的具体操作,确保开发者能够遵循一致的代码风格规范。
2735

被折叠的 条评论
为什么被折叠?



