Eclipse设置代码格式化使用空格代替TAB

Java格式设置
打开Window-Preferences,找到Java-Code Style-Formatter,点击图片中的New...

Eclipse设置代码格式化使用空格代替TAB

给配置起一个名字后,修改配置,找到 Indentation,在Tab policy上选择Spaces only,确定。

Eclipse设置代码格式化使用空格代替TAB

XML格式设置
打开Window-Preferences,找到XML-XML Files-Editor,选择 Indent using spaces,下面 Indentation size填4。

Eclipse设置代码格式化使用空格代替TAB

转载于:https://my.oschina.net/u/920274/blog/3009026