天天看點

AS插件-android-selector-chapek

概述

生成Selector的插件。

隻需要在drawable檔案夾中右鍵,在彈出的菜單中選擇Generate Android Selectors,會自動的根據你的幾個drawable檔案夾裡的資源的命名,幫你生成Selector代碼。

當然了,你的資源檔案需要根據約定的字尾來命名。比如按下狀态為_pressed,正常狀态為_normal,不可用狀态為_disable,等等。

AS插件-android-selector-chapek

下載下傳安裝

詳細的使用請檢視​​android-selector-chapek​​

兩種安裝途徑:

  • in Android Studio: go to Preferences→Plugins→Browse repositories and search for SelectorChapek
  • ​​download​​ it and install via Preferences→Plugins→Install plugin from disk

使用

1) Right-click folder with your resources e.g ‘drawable-xhdpi’

AS插件-android-selector-chapek

2) Select ‘Generate Android Selectors’

AS插件-android-selector-chapek

3) All selectors automagically appear in the ‘drawable’ folder!

AS插件-android-selector-chapek

檔案命名約定