叼花硬汉 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 微信红包不拆包 知道红包金额
  • ¥15 0基础学机器人运动控制要多久?
  • ¥15 .net core 怎么进行中英文转换
  • ¥15 数学的三元一次方程求解
  • ¥20 iqoo11 如何下载安装工程模式
  • ¥15 本题的答案是不是有问题
  • ¥15 关于#r语言#的问题:(svydesign)为什么在一个大的数据集中抽取了一个小数据集
  • ¥15 C++使用Gunplot
  • ¥15 这个电路是如何实现路灯控制器的,原理是什么,怎么求解灯亮起后熄灭的时间如图?
  • ¥15 matlab数字图像处理频率域滤波