魅力程序猿

  • 首页
  • Java
  • Android
  • APP
    • 扑克计分器
    • Video Wallpaper
  • 联系我
  • 关于我
  • 资助
道子
向阳而生
  1. 首页
  2. Android
  3. 正文

Android Studio中格式化代码

2016年9月29日 8124点热度 0人点赞 3条评论

在Eclipse中

如果我们想让一段代码格式变得整齐,可以:

  • 选中这行代码→右键单击→Source→Format
  • 或者Ctrl+Shift+F就可以了

在Android Studio中

如果我们想让一段代码格式变得整齐,可以:

  • 选中这行代码→Code→Reformed Code
  • 或者Ctrl+Alt+L就可以
    如下图:

reformat1

Android Studio中的一个小技巧:

对于一段非常零碎的代码,格式化后行间距等仍然很不顺眼,可以尝试先把代码合并成一行之后再格式化。

命令 快捷键
将代码合并成一行 Ctrl + Shift + J
格式化 Ctrl+Alt+L
标签: Android Studio中格式化代码
最后更新:2016年9月29日

daozi

这个人很懒,什么都没留下

点赞
< 上一篇
下一篇 >

文章评论

  • Leatrice

    I have admired this cuff since the moment I saw it. It speaks to me like the tide coming in at a tropical paradise. I respect the ocean and would treat this cuff with perfect admtiarion. Please pick me to take care of it and spread the word about peace, love and Mimi Boutique.

    2016年12月19日
    回复
  • appnana auto bot

    Hey, yahoo lead me here, keep up nice work.

    2017年9月28日
    回复
  • razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
    取消回复
    搜索
    联系方式

    QQ群:179730949
    QQ群:114559024
    欢迎您加入Android大家庭
    本人QQ:136049925

    赐我一丝安慰
    给我一点鼓励

    COPYRIGHT © 2023 魅力程序猿. ALL RIGHTS RESERVED.

    Theme Kratos Made By Seaton Jiang

    豫ICP备15000477号