我正在尝试使用 SuggestBox 和 MultiWordSuggestOracle 以下代码在建议下拉列表中显示一个图标和文本:
public class Suggestions implements Suggestion {
private String suggestion;
public Suggestions(){}
public Suggestions(String suggestion){
this.suggestion = new String( suggestion );
}
@Override
public String getDisplayString() {
return ( suggestion + " <img src='/images/image.png'/> " );
}
@Override
public String getReplacementString() {
return suggestion;
}}
在 onModuleLoad 函数中包含以下代码:
MultiWordSuggestOracle oracle = new MultiWordSuggestOracle(){
@Override
public boolean isDisplayStringHTML() {
return true;
}};
oracle.add(new Suggestions("A").getDisplayString());
SuggestBox suggestionBox = new SuggestBox(oracle);
问题:html 代码打印为普通文本。各位大佬能建议一下代码有什么问题吗?
谢谢!