3
How to change the color of a Delphi listview line / Android ?
To have the color changed as any condition is true:
se a = 1 then
listview.linha?.? := clBlue
entao
listview.linha?.? := clRed;
3
How to change the color of a Delphi listview line / Android ?
To have the color changed as any condition is true:
se a = 1 then
listview.linha?.? := clBlue
entao
listview.linha?.? := clRed;
1
Add a component TListView
.
In our example we will popular the Listview at the event FormCreate
:
var
i, j : Integer;
begin
for i := 1 to 10 do
with Listview1.Items.Add do begin
Caption := 'Item '+ IntToStr(i);
for j := 1 to 3 do
Subitems.Add('SubItem '+IntToStr(i)+IntToStr(j));
end;
At the event OnCustomDrawItem
of the component TListView
:
if Odd(item.index) then
Listview1.Canvas.Brush.Color := clred//Todas as linhas Ímpares
else
ListView1.Canvas.Brush.Color := clWhite;//Todas as linhas pares
Now just use your imagination and start adding the Conditions!
Browser other questions tagged android delphi
You are not signed in. Login or sign up in order to post.
but the problem that on android does not have "Oncustomdrawitem" is exactly where the business is picking up... the options of canvas.Brush is no longer the same.
– Ailton Branco
I am unable to compile an android version, but.... There is an event called Onpaint that accepts Canvas, I’ve used something similar like: Listview1.ItemAppearanceObjects.Itemeditobjects.Text.Textcolor := $F6F6F6;
– Junior Moreira