有没有人成功地将您自己的 CSS 样式应用到 GWT 的 NotificationMole。
如果我添加自己的样式名称,那么该样式仅适用于隐藏痣时不会被删除的外部 DIV,而且我无法找到将样式应用于内部 div 的方法...
最佳答案
肮脏的解决方案:
package com.google.gwt.user.client.ui; // important for package visibility access
import com.google.gwt.dom.client.DivElement;
import com.google.gwt.dom.client.SpanElement;
public class NotificationMoleHelper {
protected NotificationMole notificationMole;
public NotificationMoleHelper(NotificationMole notificationMole) {
super();
this.notificationMole = notificationMole;
}
public SpanElement getNotificationText() {
return notificationMole.notificationText;
}
public DivElement getHeightMeasure() {
return notificationMole.heightMeasure;
}
public DivElement getBorderElement() {
return notificationMole.borderElement;
}
/**
* Change heightMeasure's background color
*
* @param backgroundColor
*/
public void setBackgroundColor(String backgroundColor) {
getBorderElement().getStyle().setBackgroundColor(backgroundColor);
}
}
示例:
final NotificationMoleHelper notificationMoleHelper = new NotificationMoleHelper(notificationMole);
notificationMoleHelper.setBackgroundColor("#FF1111");
关于css - 如何使用 CSS 设置 GWT 的 NotificationMole 样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8052467/