英文:
How to always show scrollbar for ListView in JavaFX
问题
问题的要点是,我有一个 ListView,如果其中的 ListCell 超过了它可以容纳的大小,滚动条会出现并且“推动”内容向左移动。我该如何设置滚动条始终存在,而不管 ListCell 的数量如何?
以下是我的实现:
<VBox xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<ListView fx:id="ingredientListView" HBox.hgrow="ALWAYS"/>
</VBox>
在 JavaFX 中似乎没有像 Android 中的 ListView 那样的 fadeScrollbars="false"
属性。非常感谢任何帮助!
英文:
The gist of my problem is that I have a ListView, and if there are more ListCells in it than how many its size can accomodate, the scrollbar appears and "pushes" the content to the left. How do I set the scrollbar to always be present regardless of the number of ListCells?
Below is my implementation:
<VBox xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<ListView fx:id="ingredientListView" HBox.hgrow="ALWAYS"/>
</VBox>
There doesn't seem to be the fadeScrollbars="false"
property that is available in ListView in Android. Appreciate any help!
专注分享java语言的经验与见解,让所有开发者获益!
评论