Android的工作室格式code不会自动断线 [英] Android studio format code won't auto break line

查看:153
本文介绍了Android的工作室格式code不会自动断线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

    tempCanvas.drawArc(cx - mInnerCircleRadius, cy + mInnerCircleRadius,cy + mInnerCircleRadius,cy + mInnerCircleRadius);

例如,上述code是太长了,所以我想在每个打破行。 Eclipse会做,但在Android Studio中不会断线时,我打格式code 。有没有什么方法呢?

For example, the above code is too long, so i want to break line at every ,. Eclipse will do it but in android studio won't break line when i hit format code. Is there any method to do it?

推荐答案

在Android的工作室(可能其他IDE)你不刹车(套),由或其他任何字符,你定义一个最大行宽,并设置格式,以确保最大的线宽不超过。

In Android Studio (and probably any other IDE) you don't brake (wrap) lines by , or any other character, you define a maximum line width and set the formatter to ensure the maximum line width is not exceeded.

要在Android Studio中做到这一点去
preferences>编辑> code风格

To do this in Android Studio go to Preferences > Editor > Code Style

和设置右页边距(列) 120 (或线宽你想要的)

and set Right margin (columns) to 120 (or the line width you want)

现在去
preferences>编辑> code样式和GT; Java的>包装和大括号

检查复选框确保正确的利润率不超过

应用更改并preSS确定

Apply the changes and press OK

现在在编辑器中你preSS code>格式化code ... 到code画幅该行的宽度。

Now in the editor you press Code > Reformat Code... to format your code to that line width.

这篇关于Android的工作室格式code不会自动断线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆