插件的設置是在Settings的Plugins裏面,如下圖所示可以從三個渠道安裝插件,下面就看看幾個常用的插件。
Android ButterKnife Zelezny
這個插件可以從Activity/Fragment/Adapter的xml文件中生成註解,配合ButterKnife使用十分方便,省去了一羣findViewById,同時可以生成點擊事件。
SelectorChapek
用於生成selector文件,主要是根據資源文件和它的命名規則來生成對應的selector,對應條件如下:
File name suffix |
Drawable state |
_normal |
(default state) |
_pressed |
state_pressed |
_focused |
state_focused |
_disabled |
state_enabled (false) |
_checked |
state_checked |
_selected |
state_selected |
_hovered |
state_hovered |
_checkable |
state_checkable |
_activated |
state_activated |
_windowfocused |
state_window_focused |
具體的使用方法可以看看:https://github.com/inmite/android-selector-chapek
LeakCanary
https://github.com/square/leakcanary
幫助你在開發階段方便的檢測出內存泄露的問題,使用起來更簡單方便。英文不好的這裏有雷鋒同志翻譯的中文版LeakCanary中文使用說明:
https://www.liaohuqiu.net/cn/posts/leak-canary-read-me/
GsonFormat
https://github.com/zzz40500/GsonFormat
大多數數據返回都是JSON格式的,每次都要去創建一個對應的實體類,使用這個插件可以方便很多。
Android Parcelable Code Generator
簡化了Parcelable序列化的過程
lint-cleaner-plugin
https://github.com/marcoRS/lint-cleaner-plugin
這是一個資源自動清理工具,清除一些無用的資源,包括strings, colors and dimensions等
配置
首先,配置根目錄下的build.gradle文件
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.droidtitan:lint-cleaner-plugin:0.3.0'
}
}
apply plugin: 'android'
apply plugin: 'com.droidtitan.lintcleaner'
然後在項目根目錄下,執行清理命令
gradle lintClean
./gradlew lintClean
Android Postfix Completion
https://github.com/takahirom/android-postfix-plugin
ADB WIFI
利用Wifi連接來調試手機
https://github.com/layerlre/ADBWIFI
Sexy Editor
給Android Studio添加圖片背景效果
安裝重啓後,在Settings的other settings找到Sexy Editor,然後按照下面操作就可以設置了。