转载: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. spark MLLib的基础统计部分学习

    参考学习链接:http://www.itnose.net/detail/6269425.html 机器学习相关算法,建议初学者去看看斯坦福的机器学习课程视频:http://open.163.com/s ...

  2. 自己通过反射写的一个属性copy类

    package com.xxx.beancopier; import java.lang.annotation.Documented; import java.lang.annotation.Elem ...

  3. 学会Nodejs 的require和exports

    NodeJs中模块的导入和导出,是最基本的概念,但是看了之后,心里还是有一些疑惑的地方,比如: 1.有两个文件:part.js 和 main.js,main.js中要想使用part.js中定义的变量和 ...

  4. How to fix 'sudo: no tty present and no askpass program'以及硬盘序列号的读写

    在调用system命令读写硬盘序列号的过程中遇到问题,报错如下: sudo: no tty present and no askpass program 发现此问题是由于帐号并没有开启免密码导致的 . ...

  5. Kinetis学习笔记(一)——基于KSDK 2.0

  6. spring+ibatis问题1—— 程序报错:java.sql.SQLException: Io 异常: Connection reset by peer, socket write error; ”或“java.sql.SQLException 关闭的连接”异常

    转自:http://blog.sina.com.cn/s/blog_1549fb0710102whz2.html spring+ibatis程序测试时报错:java.sql.SQLException: ...

  7. Openlayer 3 删除上一次绘制的图

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  8. bash脚本退出代码解释

    Exit Codes With Special Meanings Table E-1. Reserved Exit Codes Exit Code Number Meaning Example Com ...

  9. box-size

    <style> *{ margin:0; padding:0; list-style:none; font-family:"\5FAE\8F6F\96C5\9ED1"; ...

  10. python连接MongoDB

    1.安装pymongo库 windows下: pip install pymongo 或者 easy_install install pymongo 2.使用pymongo模块连接mongoDB数据库 ...