MacBook Pro上面使用F1、F2......等時需要按住fn鍵。
| 功能描述 | keymap對應(yīng)名字 | Mac | Win/Linux |
|---|---|---|---|
| 提示錯誤解決方案 | Show Intention Actions | option + enter | alt + enter |
| AS配置界面 | Preferences | command + , | control+alt+S |
| 工程項目配置界面 | Project Structure | command + ; | Control+Alt+Shift+S |
| 快速構(gòu)成代碼 | Code Generate | command + N | alt + insert |
| 代碼提示 | Completion/Basic | control + space(mac會沖突, 手動修改) | ctrl + 空格(win同樣大部分和輸入法沖突, 手動修改) |
| 選擇視圖 | select in any view | option + F1 | alt + F1 |
| 添加書簽標(biāo)識 | Toggle Bookmark | option + F3 ct | rl + F11 |
| 向下移動一行 | Move Line Down | option + shift + Down | alt + shift + Down |
| 向上移動一行 | Move Line Up | option + shift + Up | alt + shift + Up |
| 注釋代碼 | Comment with Line Comment | command + / | ctrl + / |
| 用代碼模板包裹代碼 | surround with Live Template | command + option + J | ctrl + alt + J |
| 格式化代碼 | Reformat Code | command + option + L | ctrl + alt + L |
| Copy Reference | Copy Reference | command + option + shift + C | ctrl + alt + shift + C |
| if/try等包裹代碼 | Surround With.. | command + option + T | ctrl + alt + T |
| 查看聲明 | Declaration | command + B | ctrl + B |
| 快捷向下復(fù)制行 | Duplicate Line or Block | command + D | ctrl + D |
| 刪除行 | Delete Line | command + delete | ctrl + Y |
| 快捷最近打開 | Recent Files | command + E | ctrl + E |
| 查找 | Edit/Find/Find | command + F | ctrl + F |
| 文件方法結(jié)構(gòu) | File Structure | command + F12 | ctrl + F12 |
| 顯示書簽 | Show Bookmarks | command + F3 | shift + F11 |
| 代碼高亮向下查找 | Move To Next Occurrence | command + G | F3 |
| 代碼高亮向上查找 | Move To Previous Occurrence | command + shift + G | shift + F3 |
| 按照模板生成代碼 | Insert Live Template | command + J | ctrl + J |
| 定位到行 | Navigate/Line | command + L | ctrl + G |
| 快速到行首/尾 | Move Caret to Line Start/End | command + Left/Right | ctrl + Left/Right |
| 代碼折疊/展開 | Collapse/Expand | command + 減號/加號 | ctrl + 減號/加號 |
| 查找類 | Navigate/Class | command + O | ctrl + N |
| 多行注釋 | Code/Comment | command + option + / | ctrl + alt + / |
| 格式化代碼 | Reformat Code | command + option + L | ctrl + alt + L |
| 提示參數(shù)類型 | Parameter Info | command + P | ctrl + P |
| 查找替換 | Replace | command + R | ctrl + R |
| 查找命令 | Find Action | command + shift + A | ctrl + shift + A |
| 拷貝文件路徑 | Copy Paths | command + shift + C | ctrl + shift + C |
| 移動代碼塊 | Move Statement Up/Down | command + shift + down/up | ctrl + shift + down/up |
| 代碼補全 | Complete Current Statement | command + shift + enter | ctrl + shift + enter |
| 全路徑查找 | Find in Path | command + shift + F | ctrl + shift + F |
| 代碼高亮 | Highlight Usages in File | command + shift + F7 | alt + J |
| 窗口內(nèi)所有代碼折疊/展開 | Collapse/Expand All | command + shift + 減號/加號 | ctrl + shift + 減號/加號 |
| 查找文件 | Navigate/File | command + shift + O | ctrl + shift + N |
| 全路徑中替換 | Replace in Path | command + shift + R | ctrl + shift + R |
| 大小寫轉(zhuǎn)換 | Toggle Case | command + shift + U | ctrl + shift + U |
| 顯示粘貼版歷史 | Paste from History | command + shift + V | ctrl + shift + V |
| 快速查找定義 | command + space | ctrl + shift + I | |
| 粘貼 | Paste | command + V | ctrl + V |
| 復(fù)制 | Copy | command + C | ctrl + C |
| 去除無效包引用 | Optimize Imports | control + option + O | ctrl + alt + O |
| 顯示類關(guān)系繼承體系 | Type Hierarchy | control + H | ctrl + H |
| 快速覆寫方法 | override Methods | control + O | ctrl + O |
| 查找調(diào)用的位置 | Call hierarchy | control + option + H | ctrl + alt + H |
| 添加書簽 | Toggle Bookmark | F3 | F11 |
| 擴大縮小選中范圍 | Extend Selection/Shrink Selection | option + UP/Down | ctrl + W + shift + W |
| 跳轉(zhuǎn)到父類 | Super method | command + U | ctrl + U |
| 關(guān)閉當(dāng)前tab標(biāo)簽 | Editor Tabs / Close | command + W | ctrl + shift + a |
| 關(guān)閉除編輯窗口的其余窗口 | Hide All Tool Windows | command + shift + F12 | ctrl + shift + F12 |
| 預(yù)覽方法定義 | Quick Definition | command + Y | ctrl + shift + I |
| 返回光標(biāo)最后編輯位置 | Last Edit Location | command + shift + delete | control + shift + Backspace |
| 調(diào)到代碼塊首部/尾部 | Move Caret To Code Block | Option + Command + [ 或者 ] | Control+[ 或者 ] |
| 重命名 | Rename shift + F6 | shift + F6 | |
| 抽取方法 | Extract Method | command + option + M | control+alt+M |
| 抽取變量 | Extract Variable | command + option + V | control+alt+V |
| 抽取字段 | Extract Field | command + option + F | control+alt+F |
| 抽取常量 | Extract Constant | command + option + C | control+alt+C |
| 抽取參數(shù) | Extract Parameter | command + option + P | control+alt+P |
| 重構(gòu)入口 | Refactor This | control + T | ctrl + alt + shift + T |
條件斷點
通過右鍵斷點,可以對一個斷點加入條件。只有當(dāng)滿足條件時,才會進入到斷點中。調(diào)試神技,只對自己關(guān)心的情況進行調(diào)試,不浪費時間。
進入調(diào)試模式
點擊Attach Debugger(即綠色小蟲旁邊那個)可以快速進入調(diào)試而不需要重新部署和啟動app。
可以選擇為此功能設(shè)置一個快捷鍵或者通過前面提到的Find Actions(ctrl+shift+a)輸入”attach”進行調(diào)用。

2600456-c74e98b44682a034.gif
快速查看變量的值
按住Alt點擊想要查看的變量或者語句。如果想查看更多,則可以按Alt+f8調(diào)出Evaluate Expression窗口來自行輸入自定義的語句。
分析堆棧信息
Find Actions(ctrl+shift+a)輸入”analyze stacktrace”即可查看堆棧信息。

2600456-3d18824ca83f3bd6.gif
分析某個值的來源
Find Actions(ctrl+shift+a)輸入”Analyze Data Flow to Here”,可以查看某個變量某個參數(shù)其值是如何一路賦值過來的。對于分析代碼非常有用。

2600456-1834e6a8b873221e.gif
多行編輯
快捷鍵:Alt+J
列編輯
按住Alt加鼠標(biāo)左鍵拉框即可
按Alt+Shift+Insert之后拖框選擇
Enter和Tab在代碼提示時的區(qū)別

2600456-8d39452005febd75.gif
參考
史上最全的Android studio 的快捷鍵 MAC 和Win版本
http://blog.csdn.net/lxxlxx888/article/details/53958925
http://www.itdecent.cn/p/a12f82c2b81e