叼花硬汉 2013-05-16 06:10 采纳率: 0%
浏览 618
已采纳

安卓工作室的代码格式化快捷方式

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条回答 默认 最新

  • ~Onlooker 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 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler