我正在为Android Studio(Intellij Idea)开发一个插件。我想在执行某个动作时更改图标。
但它没有改变图标。
这是代码 -
public void actionPerformed(AnActionEvent event) {
Project project = event.getData(PlatformDataKeys.PROJECT);
ActionManager actionManager = event.getActionManager();
AnAction anAction = actionManager.getAction("York.toggle");
Presentation presentation = anAction.getTemplatePresentation();
presentation.setIcon(IconLoader.getIcon("/icons/ic_fav_search_24dp.png"));
/*String adbPath = getAdpPathOnMachine(project);
BroadcastHelper.main(new String[]{adbPath});*/
}
答案 0 :(得分:2)
使用com.intellij.openapi.actionSystem.AnActionEvent#getPresentation