我需要在选中时更改ListBoxItem的高亮颜色。
使用Android的黑暗风格,当我选择一个项目时,结果很糟糕(文本颜色为白色,项目框为浅蓝色)。
有没有办法改变高光颜色?
答案 0 :(得分:3)
颜色的定义可以通过Style文件进行。
您可以按风格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