转载:http://blog.csdn.net/androidzhaoxiaogang/article/details/7692526

  1. Download the android-formatting.xml file

  2. Open Eclipse and go to Window->Preferences->Java->Code Style->Formatter

  3. Import the android-formatting.xml file and make sure “Android” is selected in the drop down list

  4. In eclipse go to Window->Preferences->General->Editors->Text Editors

  5. Check “Insert spaces for tabs” and make sure that “Displayed tab width” is 4

  6. Check “Show print margin” and make sure that “Print margin Columns” is 100

  7. Check “Show Whitespace characters” (如果不想显示空格的童鞋,可忽略这步)

  8. In eclipse go to Window->Preferences->Java->Editor->Save Actions

  9. Check “Perform the selected actions on save”

  10. Check “Additional Actions” than hit configure

  11. Under the “Code Organizing” tab check “Remove trailing whitespace” for all lines and “Correct Indention”

  12. Under the “Code Style” tab remove all check marks

  13. Under the “Missing Code” tab check everything

  14. Now go to Window->Preferences->XML->XML Files->Editor

  15. Check “Split multiple attributes each on a new line”

  16. Check “indent using spaces” and make sure the value is set to 4

android代码格式化方法小结的更多相关文章

  1. 下载最新Android代码的方法

    之前我是去Android官方网站下载最新Android代码,但是这种方法需要FQ,而且有时候FQ又不太方便,今天我发现一个不错的网站,是清华大学搞的,跟Android官方的代码基本保持同步,而且下载方 ...

  2. Android root检测方法小结

    转载目的,之前主要应用这里的原理解决了,手机被某个APP检测为root过的手机的问题,记录后续可能参考. 出于安全原因,我们的应用程序不建议在已经root的设备上运行,所以需要检测是否设备已经root ...

  3. Android ViewPager使用方法小结

    android-support-v4.jar 是谷歌提供给我们的一个兼容低版本安卓设备的软件包,里面包囊了只有在 Android 3.0 以上可用的API.而 ViewPager 就是其中之一.利用它 ...

  4. Android PopupWindow使用方法小结

    前几天要用到PopupWindow,一时竟想不起来怎么用,赶紧上网查了查,自己写了个demo,并在此记录一下PopupWindow的用法. 使用场景 PopupWindow,顾名思义,就是弹窗,在很多 ...

  5. Android代码混淆官方实现方法

    首先查看一下 “project.properties” 这个文件: # This file is automatically generated by Android Tools.# Do not m ...

  6. 在Eclipse中格式化Android代码

    我们用Eclipse做Android开发的时候,可以导入Google提供的profile文件,这样每次"Ctrl+Shift+F"的时候,IDE就能够按照官方的规范来进行代码格式化 ...

  7. keil中使用Astyle格式化你的代码的方法2篇合

    关于Astyle Astyle 的全称是Artistic Style的简称,是一个开源的源代码格式化工具,可以对C,C++,C#以及Java等编程语言的源代码进行缩进.格式化.美化.Home Page ...

  8. 将应用代码由eclipse导入Android studio的方法NDK-Build和Cmake两种方法(以android_serialport_api为例)

    网上翻了几百篇博客,看了半天,要不就是写的乱七八糟看不懂,要不就是隐藏了一些细节,要不就是实现不了,最后还是在Android官网上看明白了,而且说得有条有理,以后遇到不懂的一定要先翻官网. 参考资料: ...

  9. ecplice中代码使用快捷键无法格式化,使用其他方法将代码格式化的步骤

    选中需要进行格式化的代码--->右键--->source--->format,就可以将代码格式化了.

随机推荐

  1. action 耦合方式

    //ActionContext 方式 package com.hanqi.action; import java.util.Map; import com.opensymphony.xwork2.Ac ...

  2. linux基础-安装篇

    linux现在的版本已经升级到7.x的版本了,现在虽然企业还是使用6.x的版本,但是未来的趋势肯定是往7的方向发展的,很多的培训机构或者一些学校的课程也都更新的7的版本进行教学,下面的安装实例就是以7 ...

  3. Oracle SQL自带函数整理

    数字函数 abs(n):用于返回数字n的绝对值 ceil(n):返回大于等于数字n的最小整数 floor(n):返回小于等于数字n的最大整数 mod(m,n):返回m/n数字相除后的余数,如果n=0, ...

  4. maven中添加proguard来混淆代码

    只要下回插件并添加相应的配置文件即可.本文仅是做下相关记录 1.修改pom.xml添加插件 <plugin> <groupId>com.pyx4me</groupId&g ...

  5. python返回null和空的不同

    mysql数据库中有的字段是NULL, 有的字段是空白 写Python脚本,fetchall()得到结果,也是不同. NULL对应的是None, 空白对应的是'' (None, '') 所以根据结果进 ...

  6. iPhone doesn’t support any of GongShangJ.app’s architectures. You can add iPhone’s armv7s architectu

    iPhone doesn't support any of GongShangJ.app's architectures. You can add iPhone's armv7s architectu

  7. SpringMVC 系列教程1-文件上传-配置

    SpringMVC默认没有配置上传解析器 使用SpringMVC来处理上传必须添加对MultipartResolver上传解析器的声明配置. 配置之后,客户端每次进行请求的时候,SpringMVC都会 ...

  8. Linux中的shell函数编写

    function huge_cp() { while read line1; do cp $line1 ../; done; } function huge_rm() { while read lin ...

  9. 版本控制器:SVN

    版本控制器:SVN 开发中的实际问题 小明负责的模块就要完成了,就在即将Release之前的一瞬间,电脑突然蓝屏,硬盘光荣牺牲!几个月来的努力付之东流--需求之一:备份! 这个项目中需要一个很复杂的功 ...

  10. hdu 1217 Arbitrage

    Flody多源最短路 #include<cstdio> #include<cstring> #include<string> #include<cmath&g ...