如何在Android Studio中创建自己的“重新格式化代码"样式? [英] How to create my own 'Reformat Code' style in Android Studio?

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

问题描述

在Eclipse中,(窗口->首选项-> Java->代码样式->格式化程序)提供了一种创建我自己的格式样式并将其应用到代码中的功能.有没有办法在Android Studio(用于Java代码)中做到这一点?

In Eclipse,(Window -> Preferences -> Java -> Code Style -> Formatter) there was a facility to create my own format style and apply it in the code. Is there a way to do that in Android Studio(for Java code) ?

推荐答案

要更改格式化程序选项,请转到File | Settings | Code Style | Java

To change formatter options go to File | Settings | Code Style | Java

要手动重新格式化代码,请按 Ctrl + Alt + L (或使用菜单Code | Reformat code...).要重新格式化模块的整个源代码,只需首先选择模块文件夹.

To reformat your code manually, press Ctrl + Alt + L (or using the menu Code | Reformat code...). To reformat the whole source code of your module, just select the module folder first.

有关重新格式化源代码的更多信息,可以在 IntelliJ Web帮助中找到

More information about reformating source code can be found on the IntelliJ Web Help

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

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