如何在Android Studio中对齐/格式化代码? [英] How do I align/format code in Android Studio?
本文介绍了如何在Android Studio中对齐/格式化代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有一种方法/快捷方式/内置功能可以对齐操作数的代码,例如'='符号?
Is there a way/shortcut/built-in feature that can align code for operands, like '=' signs?
例如,有一个XAlign用于Xcode( https://github.com/qfish/XAlign ),允许用户选择需要对齐并使用快捷方式自动对齐。
For example, there is a XAlign for Xcode (https://github.com/qfish/XAlign), allowing the user to select code that needs to be aligned and use a shortcut to align it automatically.
Android Studio中有一个 Fields Group 功能,该功能可以按列对齐,但不适用于已编写的代码。
There is a Fields Group feature in Android Studio which can "Align in columns", but it does not work for code that is already written.
推荐答案
Android Studio中的缩进代码:
Windows
Ctrl + Alt + L
Mac:
Option + Command + L
这篇关于如何在Android Studio中对齐/格式化代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文