您的位置:首页 > 移动开发 > Android开发

android studio 代码快捷键

2016-07-18 15:52 232 查看
android  studio 的代码快捷键,代码块

////输出打印

Groovy(常规部分)---->

serr --->System.err.println("example")

souf --->printf "example"

sout --->println "example"

soutm --->System.out.println("MainActivity.onCreate");//当前类的当前方法名

soutp --->System.out.println("savedInstanceState = [" + savedInstanceState + "]");//这个好,可以打印出当前方法的所有参数列表及其值

soutv --->System.out.println("params",params);//即 你可以输出打印一个变量值

//(常规的代码块儿)

Iteractions--->//快速生成代码块儿

fori --->for (int i = 0; i < ; i++) {}

itar --->for (int i = 0; i < Array.length; i++) { int i1 = Array[i];}//遍历数组

itco --->for (Iterator iterator = collection.iterator(); iterator.hasNext(); ) {

Object next = iterator.next();

}//这个是遍历一个容器变量的,直接让容器返回一个iterator进行遍历

iten --->while (枚举类.hasMoreElements()) { Object nextElement = 枚举类.nextElement(); }//enumeration 是一个枚举类接口来着。遍历枚举内容

iter --->for (int i : FOCUSED_STATE_SET) {...}//遍历选中状态下的set

itit --->while (iterator.hasNext()) { Object next = iterator.next(); }//获取到了迭代器对象后,对迭代器进行遍历操作

itli --->for (int i = 0; i < list.size(); i++) { Object o = list.get(i); }//遍历list对象里面的内容

ritar --->for (int i = Array.length - 1; i >= 0; i--) { int i1 = FOCUSED_STATE_SET[i]; }//倒叙遍历数组

//其他的(综合)

geti --->public static MainActivity getInstance() { return ; }//获取到当前的实例 的代码模板

ifn --->if (某变量 == null) {....}//生成if null代码块儿

inn --->if (某变量 != null) {....}//生成if not null代码块儿

inst --->if ($EXPR$ instanceof $TYPE$) { $TYPE$ $VAR1$ = ($TYPE$)$EXPR$; $END$ }//判断某变量是不是某个类的实例对象

lazy --->if (savedInstanceState == null) { savedInstanceState = new Bundle(); }//执行延迟初始化,就是对象直到用的时候才进行初始化操作

mn --->var1 = Math.min(var2,var3);//得到比较两个变量值小的代码块

mx --->var1 = Math.max(var2,var3);//得到比较两个变量值大的代码块

psvm --->public static void main(String[] args){ 。。。。 }//生成一个main()函数的代码块

toar --->something.toArray(new collection[collection.size()])//这个是生成一个代码块用于把collection的对象存储到一个数组里面去.实用!

//普通的代码(修饰符部分的)

psf --->public static final 

psfi --->public static final int 

psfs --->public static final String 

St --->String 

thr --->throw new 

IDEA 快捷键

 

这是从IDEA官网下载的IDEA keymap Windows/Linux,中文我会慢慢补充上去。

因为AS是基于IDEA社区版开发的,所以快捷键都AS同样适用。

IntelliJ IDEA Default Keymap 

To find any action inside the IDE use

Find Action     Ctrl+Shift+A/ A    查找快捷键,action快捷入口的快捷键

Editing 编辑
Ctrl + SpaceBasic code completion (the name of any class,method or variable)基本的代码补全
Ctrl + Shift + SpaceSmart code completion (filters the list of methodsand variables by expected type)智能代码补全
Ctrl + Shift + EnterComplete statement补全当前语句
Ctrl + PParameter info (within method call arguments)显示函数的参数信息
Ctrl + QQuick documentation lookup快速文档查找
Shift + F1External Doc外部文档
Ctrl + mouse over code Brief Info简要信息显示
Ctrl + F1Show descriptions of error or warning at caret显示错误或警告的说明
Alt + InsertGenerate code... (Getters, Setters, Constructors,hashCode/equals, toString)生成(Getters, Setters, Constructors,hashCode/equals, toString)代码
Ctrl + OOverride methods重写方法
Ctrl + IImplement methods实现方法
Ctrl + Alt + TSurround with… (if..else, try..catch, for,synchronized, etc.)用if..else, try..catch, for,synchronized等环绕代码块
Ctrl + / Comment/uncomment with line comment注释/取消注释代码行
Ctrl + Shift + /Comment/uncomment with block comment注释/取消注释代码块
Ctrl + W Select successively increasing code blocks依次选择更多的代码块
Ctrl + Shift + W     Decrease current selection to previous state依次减少选择的代码块
Alt + Q Context info
Alt + Enter Show intention actions and quick-fixes显示意图行动和快速修复
Ctrl + Alt + LReformat code重新格式化代码
Ctrl + Alt + OOptimize imports优化导入的import
Ctrl + Alt + I Auto-indent line(s)自动缩进行
Tab / Shift + Tab Indent/unindent selected lines缩进/取消缩进
/Ctrl + X or Shift + Delete Cut current line or selected block to clipboard剪切当前行或者选中的代码段到剪切板
Ctrl + C or Ctrl + InsertCopy current line or selected block to clipboard复制当前行或者选中的代码段到剪贴板
Ctrl + V or Shift + InsertPaste from clipboard从剪切板粘贴
Ctrl + Shift + VPaste from recent buffers...粘贴最近复制的内容
Ctrl + DDuplicate current line or selected block复制当前行或选中的代码
Ctrl + YDelete line at caret删除行
Ctrl + Shift + JSmart line join智能合并行
Ctrl + EnterSmart line split智能分割行
Shift + EnterStart new line新建一行
Ctrl + Shift + UToggle case for word at caret or selected block将选中代码块转为小写
Ctrl + Shift + ] / [ Select till code block end/start向前/向后选中代码段
Ctrl + DeleteDelete to word end向后删除一个单词
Ctrl + BackspaceDelete to word start向前删除一个单词
Ctrl + NumPad+/-Expand/collapse code block展开/折叠代码段
Ctrl + Shift + NumPad+Expand all全部展开
Ctrl + Shift + NumPad- Collapse all全部折叠
Ctrl + F4 Close active editor tab关闭当前标签
Search/Replace 查找/替换

Double ShiftSearch everywhere搜索任何地方的任何东西
Ctrl + FFind查找
F3        Find next查找下一个
Shift + F3Find previous查找上一个
Ctrl + R Replace替换
Ctrl + Shift + FFind in path在路径中查找
Ctrl + Shift + RReplace in path在路径中替换
Ctrl + Shift + SSearch structurally (Ultimate Edition only)查找机构(商业版有效)
Ctrl + Shift + MReplace structurally (Ultimate Edition only)替换结构(商业版有效)
Usage Search 查找使用
Alt + F7 / Ctrl + F7Find usages / Find usages in file查找使用
Ctrl + Shift + F7Highlight usages in file在文件中高亮被使用处
Ctrl + Alt + F7Show usages显示使用
Compile and Run 编译和运行
Ctrl + F9Make project (compile modifed and dependent)编译项目
Ctrl + Shift + F9Compile selected file, package or module编译选中的文件、包或者木块
Alt + Shift + F10Select configuration and run选择配置然后运行
Alt + Shift + F9Select configuration and debug选择哦诶之然后调试
Shift + F10Run运行
Shift + F9Debug调试
Ctrl + Shift + F10Run context configuration from editor
Debugging 调试
F8Step over跳过函数执行
F7Step into单步执行
Shift + F7Smart step into智能但不执行
Shift + F8Step out跳出函数执行
Alt + F9Run to cursor运行到光标处
Alt + F8Evaluate expression
F9Resume program继续执行
Ctrl + F8Toggle breakpoint切换断点
Ctrl + Shift + F8View breakpoints查看断点
Navigation 导航
Ctrl + NGo to class查找/跳到类
Ctrl + Shift + NGo to file查找文件
Ctrl + Alt + Shift + NGo to symbol查找符号
Alt + Right/LeftGo to next/previous editor tab
F12Go back to previous tool window
EscGo to editor (from tool window)
Shift + EscHide active or last active window
Ctrl + Shift + F4Close active run/messages/find/... tab
Ctrl + GGo to line
Ctrl + E Recent files popup    最近打开的文件
Ctrl + Alt + Left/RightNavigate back/forward回到上一步/下一步编辑的地方
Ctrl + Shift + BackspaceNavigate to last edit location回到最后编辑的地方
Alt + F1Select current file or symbol in any view在任意视图中选中当前文件或者符号
Ctrl + B or Ctrl + ClickGo to declaration到变量定义处
Ctrl + Alt + BGo to implementation(s)到方法的实现处
Ctrl + Shift + IOpen quick definition lookup打开定义快速查找
Ctrl + Shift + BGo to type declaration跳转到方法定义处
Ctrl + UGo to super-method/super-class跳转到父方法/父类
Alt + Up/DownGo to previous/next method跳转到上一个/下一个方法
Ctrl + ] / [Move to code block end/start跳到代码段的开始/结尾
Ctrl + F12File structure popup弹出文件结构视图
Ctrl + HType hierarchy类型的层次结构?
Ctrl + Shift + HMethod hierarchy方法的层次结构?
Ctrl + Alt + HCall hierarchy调用的层次结构(查找方法/符号的调用方)
F2 / Shift + F2Next/previous highlighted error下一个(上一个)高亮的错误
F4 / Ctrl + EnterEdit source / View source编辑/查看文件源码
Alt + HomeShow navigation bar显示导航栏
F11Toggle bookmark增加书签
Ctrl + F11Toggle bookmark with mnemonic增加带符号的书签
Ctrl + #[0-9]Go to numbered bookmark跳到标记数字的书签
Shift + F11Show bookmarks显示书签
Refactoring 代码重构
F5Copy复制
F6Move移动
Alt + DeleteSafe Delete安全删除
Shift + F6Rename重命名变量/方法名
Ctrl + F6Change Signature改变
Ctrl + Alt + NInline
Ctrl + Alt + MExtract Method
Ctrl + Alt + VExtract Variable
Ctrl + Alt + FExtract Field
Ctrl + Alt + CExtract Constant
Ctrl + Alt + PExtract Parameter
VCS/Local History 版本管理/本地历史
Ctrl + KCommit project to VCS
Ctrl + TUpdate project from VCS
Alt + Shift + CView recent changes查看最近更改的内容
Alt + BackQuote (`)‘VCS’ quick popup
Live Templates 动态模板
Ctrl + Alt + JSurround with Live Template环绕的动态模板
Ctrl + JInsert Live Template插入动态模板
iterIteration according to Java SDK 1.5 style
inst Check object type with instanceof and downcast it
itcoIterate elements of java.util.Collection
itit Iterate elements of java.util.Iterator
itliIterate elements of java.util.List
psfpublic static final
thrthrow new
General 通用
Alt + #[0-9] Open corresponding tool window打开相应的工具窗口
Ctrl + S Save all保存
Ctrl + Alt + YSynchronize同步
Ctrl + Shift + F12Toggle maximizing editor最大化编辑窗口
Alt + Shift + FAdd to Favorites添加到Favorites
Alt + Shift + IInspect current file with current profile
Ctrl + BackQuote (`) Quick switch current scheme
Ctrl + Alt + SOpen Settings dialog打开设置窗口
 Ctrl + Alt + Shift + S
Open Project Structure dialog打开项目结构窗口
Ctrl + Shift + A Find Action查找快捷键
Ctrl + TabSwitch between tabs and tool window在选项卡和工具窗口之间切换


与Ubuntu系统快捷键冲突的地方

Here’s a list of tweaks you need to make with default system key bindings so that they won’t interfere with IntelliJ IDEA actions (listed in brackets).
Disable the Shade window action, assigned to Ctrl + Alt + S (Settings dialog)
Change or disable the Lock Screen action, assigned to Ctrl + Alt + L (Reformat code)
Change or disable the Launch terminal action, assigned to Ctrl + Alt + T (Surround with)
Change or disable the Switch to workspace action, assigned to Сtrl + Alt + Arrows (Navigation)
Disable the Move window action, assigned to Alt + F7 (Find usages)
Change or disable the Resize window action, assigned to Alt + F8 (Evaluate expression
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  代码快捷键