0
我工作一点点从JavaFx2 ListView。我遇到了一个问题。 是否可以关闭ListCell/ListView的剪辑? 我添加的ImageView必须比ListView更宽,而JavaFx2会自动显示滚动条。ListView剪辑
这是我的代码剪断我如何的ImageView添加到我的列表:
list.setCellFactory(new Callback<ListView<String>, ListCell<String>>() {
@Override
public ListCell<String> call(ListView<String> param) {
final ListCell<String> blub = new ListCell<String>() {
@Override
protected void updateItem(String item, boolean empty) {
super.updateItem(item, empty);
if (item != null) {
StackPane p = new StackPane();
Label label = new Label(item);
p.getChildren().addAll(img, label);
setGraphic(p);
p.setAlignment(Pos.CENTER_LEFT);
}
}
};
blub.setStyle("-fx-background-color:transparent");
return blub;
}
});
非常感谢!
谢谢你的回答。我正在研究解决方案,如果我找到了一个很好的解决方案,我会在这里提交。 – moohkooh 2012-07-27 06:08:36