如何使Android Studio中/格式code? [英] How to align/format code in Android Studio?
问题描述
有没有一种方法/快捷/内置功能,可以调整code像'='符号操作数。
Is there a way/shortcut/built-in feature that can align code for operands like '=' signs.
例如,对于X code进行XAlign( https://github.com/qfish/ XAlign ),允许用户选择code需要被对齐,并使用快捷方式自动对齐。
For example, there is a XAlign for Xcode (https://github.com/qfish/XAlign), allowing user to select code that needs to be aligned and use shortcut to align it automatically.
有在Android的Studio中的字段组功能,可以在列中对齐,但它不会为已经写入code工作。
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.
在此先感谢! :)
推荐答案
有关变量声明的对齐方式适用于只有那些功能之外。在preference对准部件 - > code类 - >包装和大括号 - >字段组 - >中的列对齐不适用于这些括号/括号内工作。
The alignment for variable declarations works for only those that are outside of functions. The Alignment feature in the Preference -> Code Style -> Wrapping and Braces -> Fields Groups -> "Align in Columns" does not work for those inside the brackets/braces.
下面是JetBrains的网站上发行票: https://youtrack.jetbrains.com/问题/ IDEA-56947#
Here is a Issue Ticket on JetBrains website: https://youtrack.jetbrains.com/issue/IDEA-56947#
此功能可用,但不是在稳定的版本呢。
它可以从构建:140.1761
this feature is available but not in the stable release yet. It is available from build: 140.1761
在写这个回答我当前构建的时间是135.1653844,建于2014年12月18日关于稳定版本。
At the time of writing this answer my current build is "135.1653844, built on December 18, 2014" on Stable Release.
希望这有助于
这篇关于如何使Android Studio中/格式code?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!