我想知道是否可以更改 Android Studio 中的自动格式,将匿名类的大括号放置在同一行,同时仍将常规类、方法和块的大括号放置在新行上。
目前,IntelliJ 给了我这个结果:
class TestClass
{
public void test()
{
FooBar foo = new FooBar(new Runnable() // I want the brace here...
{ // ...not here.
@Override
public void run()
{
//
}
});
}
}
Run Code Online (Sandbox Code Playgroud)
但是,我希望代码的格式如下:
class TestClass
{
public void test()
{
FooBar foo = new FooBar(new Runnable() { // <- Same Line
@Override
public void run()
{
//
}
});
}
}
Run Code Online (Sandbox Code Playgroud)
一切都很好,除了一个细节,即我无法像第二个示例中那样格式化大括号。这是不可能的还是我只是忽略了设置?
code-formatting intellij-idea anonymous-class android-studio