如何在 Android Studio 中对齐/格式化代码? [英] How do I align/format code in Android Studio?

查看:55
本文介绍了如何在 Android Studio 中对齐/格式化代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种方法/快捷方式/内置功能可以对齐操作数的代码,例如="符号?

Is there a way/shortcut/built-in feature that can align code for operands, like '=' signs?

例如,Xcode 有一个 XAlign (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


苹果机:

选项 + 命令 + L

这篇关于如何在 Android Studio 中对齐/格式化代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆