本文宗旨在于提高编码效率,使用模版解决编写重复代码的痛苦
Live Templates 实时模版
输入对应关键词,则会提示是否按照模版生成代码,例:
1、创建模版

2、具体的语法
- 对象要类名 + 包名
-
点击 Define 修改对应的语言类型,常用的就 java->statement, kotlin->statement
语言类型
-
点击 edit variables 修改可以引用的资源,引用kotlin方法名:kotlinFunctionName,引用kotlin类名:groovyScript("_1 ?: '<top>'", kotlinClassName())
variables.png
- 实在不懂就看看自带的代码模块怎么写的,谢谢
android.widget.Toast.makeText($context$, "$text$", Toast.LENGTH_SHORT).show();
网友评论