我正在为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});*/
    }

最佳答案

使用com.intellij.openapi.actionSystem.AnActionEvent#getPresentation

08-04 01:25