新装AndroidStudio后我们一般会做如下配置:
配置代码块
1、打开setting页面
![](https://img.haomeiwen.com/i2702540/4a5b291861651c20.png)
2、点击Templates Group进入下图页面,自己命名模板组
![](https://img.haomeiwen.com/i2702540/4727e551e7886e77.png)
3、随便取个名字
![](https://img.haomeiwen.com/i2702540/3bc44ccd44d104d5.png)
4、选中自己已经命名的模板组点击右上角“+”中的第一个Live Template
![](https://img.haomeiwen.com/i2702540/4b2b70969278b1a7.png)
5、进入到自定义模板界面,自定义模板缩写样式,模板描述和模板代码
![](https://img.haomeiwen.com/i2702540/08b9836c84fe705a.png)
switch 代码块(用两个美元符号包裹起来说明是变量)
switch ($key$) {
case $value$:
break;
case $value$:
break;
default:
break;
}
单例代码块
private volatile static $className$ s$className$ = null;
private $className$ (Context context) {}
public static $className$ getInstance(Context context) {
if ($className$.class == null) {
synchronized ($className$.class) {
if (s$className$ == null) {
s$className$ = new $className$(context);
}
}
}
return s$className$ ;
}
6、点击上图中的Define选择在java代码中提示
![](https://img.haomeiwen.com/i2702540/d3d893af8ea768f1.png)
7、点击OK提交便可以使用自定义的模板了
添加类注释
![](https://img.haomeiwen.com/i2702540/ab2cb6b878c319a4.png)
类注释代码块
/************************************************************************
* @Author:
* @Description: ${PROJECT_NAME}
* @CreateDate: ${DATE} ${TIME}
* @QQ:
***********************************************************************
*/
成员变量首字母m、s开头
![](https://img.haomeiwen.com/i2702540/b0c33dd7035f9548.png)
ButterKnife生成成员变量+m
![](https://img.haomeiwen.com/i2702540/02bbcc484179f05d.png)
添加忽略文件(git或者svn,不需要上传的文件)
忽略的文件:
1、.idea文件夹
2、.gradle文件夹
3、所有的build文件夹
4、所有的.iml文件
5、local.properties文件
![](https://img.haomeiwen.com/i2702540/551cd016cc1340c5.png)
![](https://img.haomeiwen.com/i2702540/82e95537b78a9388.png)
AndroidStudio中关联SVN
![](https://img.haomeiwen.com/i2702540/9cb70398438a6d7c.png)
![](https://img.haomeiwen.com/i2702540/0955cb0252f8fc83.png)
设置svn按钮显示在AndroidStudio控制栏中
![](https://img.haomeiwen.com/i2702540/33463ffeb4c994ff.png)
![](https://img.haomeiwen.com/i2702540/aac6334616ff53b7.png)
![](https://img.haomeiwen.com/i2702540/5f3a239f29c8c3ac.png)
常用插件
-
ButterKnife Zelezny(注解插件)
注解插件.png
最关键的一步到了。你还需要在build.gradle(Module.app);这个文件中进行配置
在其中加入 compile 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
这句话,就可以正常使用注解了
-
GsonFormat(json解析插件)
gson解析插件.png
-
Alibaba Java Coding Guidelines(代码检测规范阿里插件)
阿里代码检测规范插件.png
上一篇:APK反编译工具使用教程
网友评论