我需要更改选中项的ListBoxItem的高亮颜色。在Android上使用黑暗风格时,当我选择一个项目时,结果非常糟糕(文本为白色,项目框为浅蓝色)。是否有一种方法来更改高亮显示的颜色?
颜色的定义可以通过样式文件实现。
您可以搜索样式 ListBoxItemStyle
,在其中找到 TColorAnimation
,它具有 Trigger = IsSelected
,在那里您可以更改颜色。
以下是我样式的示例:
object TLayout
StyleName = 'ListBoxItemStyle'
DesignVisible = False
Height = 20.000000000000000000
Width = 50.000000000000000000
object TText
StyleName = 'text'
Align = alClient
Color = claBlack
Height = 18.000000000000000000
HitTest = False
HorzTextAlign = taLeading
Margins.Left = 3.000000000000000000
Margins.Top = 1.000000000000000000
Margins.Right = 3.000000000000000000
Margins.Bottom = 1.000000000000000000
Width = 44.000000000000000000
WordWrap = False
object TColorAnimation
Duration = 0.001000000047497451
PropertyName = 'Color'
StartValue = claBlack
StopValue = claAzure
Trigger = 'IsSelected=true'
TriggerInverse = 'IsSelected=false'
end
end
object TCheckBox
StyleName = 'check'
Align = alLeft
CanFocus = False
DisableFocusEffect = True
Height = 20.000000000000000000
StyleLookup = 'ListBoxItemcheck'
TabOrder = 1
Visible = False
Width = 20.000000000000000000
end
end