Intellij Idea / Android Studio中的Android代码样式 [英] Android Code Style in Intellij Idea / Android Studio

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

问题描述

在Android Studio之前,我使用的是 android-formatting.xml 作为Eclipse中的代码样式。

Before Android Studio, I was using android-formatting.xml as Code Style in Eclipse.

如何在Eclipse中设置Android Studio / Intellij Idea格式化代码?

How can I setup Android Studio / Intellij Idea to format code as in Eclipse?

UPDATE

我试过Eclipse Code Formatter插件。它似乎工作,但你不能编辑任何设置。我的团队喜欢120列而不是100列。

I tried Eclipse Code Formatter plugin. It seems to work, but you cannot edit any setting at all. My team prefers 120 columns instead of 100.

我也试过@CrossleSong回答。这有点棘手,但更强大。您可以保存此

I tried @CrossleSong answer too. It's a bit tricky, but more powerful. You can save this

https://android.googlesource.com/platform/development/+/android-4.2.2_r1.2/ide/intellij/codestyles/AndroidStyle.xml

作为 Android.xml 并将其复制到AndroidStudio / Intellij codestyles文件夹:

as Android.xml and copy it to AndroidStudio/Intellij codestyles folder: for me is

〜/ Library / Preferences / AndroidStudioPreview / codestyles

现在可以在Android Studio偏好设置中选择Android作为代码样式。

Now you can select Android as Code Style in Android Studio Preferences.

推荐答案

您可以下载开发 repo从Android源。 development / ide / intellij 文件夹包括代码样式,模板...

You can download the development repo from Android source. The development/ide/intellij folder includes code style, templates...

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

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