简体   繁体   English

为什么Android Studio会丢弃我的代码样式设置?

[英]Why does Android Studio throw away my Code Style settings?

I am trying to write an Android app in Java. 我正在尝试用Java编写Android应用程序。 In Android Studio, I go to 在Android Studio中,我去了

File->Settings->Editor->Code Style->Java 文件 - >设置 - >编辑器 - >代码样式 - > Java

Then for Project, I modify the curly braces (I can't read code with unaligned curly braces), click apply, and finally click OK. 然后对于Project,我修改花括号(我无法读取带有未对齐花括号的代码),单击“应用”,最后单击“确定”。

But then I reopen the settings to find that my settings have been discarded and it has reverted my code style. 但后来我重新打开设置,发现我的设置已被丢弃,并且它已恢复我的代码样式。

How do I prevent it from reformatting to a different style? 如何防止它重新格式化为不同的样式?

I'm not sure if I undestand properly your question but I think that you want to put "Braces" in the next line, isn't it? 我不确定我是否正确地解决了你的问题,但我认为你想把“大括号”放在下一行,不是吗?

You must edit at: 您必须编辑:

File->Settings->Editor->Code Style->Java 文件 - >设置 - >编辑器 - >代码样式 - > Java

Then, 然后,

Select Project or Default -> Wrapping and Braces -> Braces Placement -> NextLine 选择Project或Default - > Wrapping and Braces - > Braces Placement - > NextLine

Let me know if works? 让我知道是否有效? For me, it is working fine: 对我来说,它工作正常:

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM