【发布时间】:2021-05-18 00:52:06
【问题描述】:
我尝试使用contentItem 自定义滚动条,但在这种情况下滚动条不显示。还有其他方法可以改变 ScrollBar 颜色吗?
ListView {
anchors.fill : parent
ScrollBar.vertical : ScrollBar {
anchors.rightMargin: 10 * AppTheme.scaleValue
contentItem: Rectangle {
color: "red"
}
}
boundsBehavior : Flickable.StopAtBounds
currentIndex : 0
focus : true
clip : true
model : checkDataModel
delegate: Rectangle {
id : rect
width : onlineChecksUpperPanel.width - 15 * AppTheme.scaleValue
height : 40 * AppTheme.scaleValue
color : index % 2 == 0 ? "#ECEEF1" : "#FFFFFF"
Text {
text : checkNum
font.family : AppTheme.fontBold.name
font.pixelSize : AppTheme.textSizePxSmaller
textFormat : Text.StyledText
color : AppTheme.textColorTouchDark
anchors.verticalCenter: parent.verticalCenter
leftPadding: 16 * AppTheme.scaleValue
}
}
}
【问题讨论】: