cha*_*ura 1 android code-formatting android-studio
我正在使用Android Studio并在格式化代码时遇到问题.如果有一个语句分成多行,我需要将其格式化为单行语句,我不能使用(Ctrl + Alt + L).代码未使用该快捷方式格式化为单行.
我尝试将右边距(设置 - >编辑器 - >代码样式)的值更改为更高的数字,但这也不起作用.
如何将代码格式化为单行?
谢谢.
首先去Preferences > Editor > Code Style并设置Right margin (columns)为140(或更高)
现在去Preferences > Editor > Code Style > Java > Wrapping and Braces > Keep when reformatting和uncheck复选框Line Breaks,这样格式化将删除不必要的换行符,使语句适应尽可能在一个单行
还建议,在Preferences > Editor > Code Style > Java > Wrapping and Braces确保check复选框时Ensure right margin is not exceeded,格式化程序将在语句超出最大右边距时强制换行.
| 归档时间: |
|
| 查看次数: |
2510 次 |
| 最近记录: |