我曾试图找出如何使用CustomListCell一个ListView在JavaFX,但没有运气,我抬头一看,所有我能找到的不完整的教程和问题。下面是我的CustomListCellFXML
<AnchorPane id="AnchorPane" styleClass="backPane"
stylesheets="@../css/mainwindow.css" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1">
<children>
<HBox alignment="CENTER_LEFT" styleClass="backPane">
<children>
<HBox styleClass="card" HBox.hgrow="ALWAYS">
<children>
<ImageView fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../images/picture_placeholder.png" />
</image>
</ImageView>
<VBox HBox.hgrow="ALWAYS">
<children>
<Label fx:id="lbTitle" styleClass="fixture-title" stylesheets="@../css/mainwindow.css" text=" Livingston 19:45 Falkirk" />
<Label fx:id="lbDescription" styleClass="fixture-description" text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin at turpis nisl. Interdum et malesuada fames ac ante ipsum primis in faucibus. Vestibulum laoreet elementum velit. Curabitur tincidunt finibus malesuada. …Run Code Online (Sandbox Code Playgroud)