Live Templates系列:
一、layout模板
tv:
android:id="@+id/tv_exp_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:includeFontPadding="false"
android:textColor="@color/bbs_main_yellow"
android:textSize="14sp"
android:text="颜值" />
--------------------------------------------
image:
android:id="@+id/xxx"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:src="@drawable/xxx" />
二、注释模板
1、${USER} 找到androidstudio的安装目录/bin下面的idea.exe.vmoptions 和idea64.exe.vmoptions这两个文件,在里面添加 -Duser.name=bruce.zhang
2、快捷键 类注释没有快捷键,方法注释有(Ctrl+Alt+1)。类注释需要在Live Templates设置。http://blog.csdn.net/sun_promise/article/details/45642319
3、方法默认修改 方法注释如果通过Live Templates修改的话,不灵活,没法获取生成参数信息。可以通过javadoc插件实现。
三、java代码片段
singleton:
private $CLASS$() {}
private static class SingletonLoader {
private static final $CLASS$ INSTANCE = new $CLASS$();
}
public static $CLASS$ getInstance() {
return SingletonLoader.INSTANCE;
}
--------------------------------------------