我有一个包含ListCells的ListView,它包含一个由SvgPath定义的图标.
private class CustomCell extends ListCell {
private SVGPath icon = new SVGPath();
public CustomCell() {
icon.setContent("...");
}
@Override
public void updateItem(String value, boolean empty) {
super.updateItem(value, empty);
if(empty || value == null) {
setGraphic(null);
setText(null);
} else {
setGraphic(icon);
setText(value);
}
}
}
我希望图标填充列表单元格的高度(大约30px).但它总是显示非常大,并且单元格的大小设置为图标的高度.
即使我设置了列表单元格和图标的大小
public CustomCell()
{
setPrefHeight(30);
setMaxHeight(30);
icon.setContent("...");
icon.maxHeight(30);
icon.prefHeight(30);
}
它不起作用.列表单元格的高度是正确的,但图标仍然显示得太大.
我哪里错了?
编辑:
这是我的svg的路径:
M 289.00,74.00 C 299.18,61.21 307.32,52.80 320.00,42.42 331.43,33.07 343.66,26.03 357.00,19.84 427.64,-12.98 509.92,2.91 564.42,58.28 583.93,78.10 595.94,99.15 605.58,125.00 607.76,130.86 611.37,144.75 612.54,151.00 613.15,154.23 613.28,160.06 615.58,162.44 617.49,164.42 624.11,165.84 627.00,166.86 634.80,169.62 639.97,172.04 647.00,176.42 673.69,193.07 692.76,221.39 695.83,253.00 700.60,302.03 676.64,345.41 630.00,364.00 621.17,3