如何在android studio中对齐语句?
如何将语句对齐,如下所示:如何在android studio中对齐语句?,android,android-studio,Android,Android Studio,如何将语句对齐,如下所示: textView1 = findViewById(R.id.textView1); textView2 = findViewById(R.id.textView2); textView3 = findViewById(R.id.textView3); textView4 = findViewById(R.id.textView4); textView5 = findViewById(R.id.textView5); bu
textView1 = findViewById(R.id.textView1);
textView2 = findViewById(R.id.textView2);
textView3 = findViewById(R.id.textView3);
textView4 = findViewById(R.id.textView4);
textView5 = findViewById(R.id.textView5);
button = findViewById(R.id.button);
而不是
textView1 = findViewById(R.id.textView1);
textView2 = findViewById(R.id.textView2);
textView3 = findViewById(R.id.textView3);
textView4 = findViewById(R.id.textView4);
textView5 = findViewById(R.id.textView5);
button = findViewById(R.id.button);
在Android Studio中?以下适用于Java的功能可能也适用于Kotlin 转到文件>设置>编辑器>代码样式>Java>换行和大括号>组声明>(选中列中的对齐字段)
我建议您使用数据绑定,因为它可以帮助您减少代码行,甚至可以帮助您避免空指针。