衫裤跑路 2013-05-16 06:10 采纳率: 50%
浏览 319
已采纳

工作室中的代码格式快捷方式

I have started developing with Android Studio. In eclipse I was using <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>F</kbd> but in Android studio it does not work, It will be different.

How can I jump to any method in .java. I was using <kbd>Ctrl</kbd>+<kbd>O</kbd> in eclipse.

Is it available? Can any one tell me that shortcut for code formatting?

转载于:https://stackoverflow.com/questions/16580171/code-formatting-shortcut-in-android-studio

  • 写回答

19条回答 默认 最新

  • 斗士狗 2013-05-16 06:13
    关注

    Win

    <kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <kbd>L</kbd>

    Linux:

    <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Alt</kbd> + <kbd>L</kbd>

    Mac:

    <kbd>Option</kbd> + <kbd>Command</kbd> + <kbd>L</kbd>

    Reference : Key Commands and here is full commands for Windows/ Linux users and for Mac users


    Update for Ubuntu As Rohit faced the problem in Ubuntu to format code shortcut, because the <kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <kbd>L</kbd> key is used to lock the screen in Ubuntu.

    I found that Ubuntu which handles the key event first. So try to change the <kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <kbd>L</kbd> action in Ubuntu just to be sure.

    Steps are :-

    Go to System Tools -> System Settings -> Keyboard -> Shortcuts Tab -> System -> Lock Screen

    Select the row New Accelerator... will be visible then press any Special key with Alpha key (like <kbd>Shift</kbd> + <kbd>L</kbd>). You changed the key shortcuts.

    Now check format key in Studio.

    Alternatively

    <kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <kbd>Shift</kbd> + <kbd>L</kbd> (for a dialog)


    Update came from Henry Chuang, and also in another answer given by user2340612.

    You can also use Eclipse shortcuts. Windows and Linux, go to File > Settings > Keymap , Mac OS X, go to > Preferences > Keymap and choose Eclipse from the dropdown menu.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(18条)

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器