【问题标题】:TListView change color from existing item android platformTListView 从现有项目 android 平台更改颜色
【发布时间】:2017-09-05 09:26:24
【问题描述】:

我需要一些示例,如何从 FireMonkey 中的 list view 更改每一行的颜色文本项。

我尝试了类似的方法,但没有成功。

 for i := 0 to lvArtikli.ItemCount-1 do
        begin

          AItem := lvArtikli.Items.AppearanceItem[i];

          pk := AItem.Data['txtPK'].AsString;

          if pk = '' then
          begin
             //change color
            TListItemText(AItem.Objects.FindDrawable('txtPK')).TextColor := TAlphaColorRec.Red;

          end;

  end;

【问题讨论】:

  • @RBA 这是针对 android 的,我不认为上面的(链接)示例包含相同的平台。
  • @RBA 我做了.....

标签: android delphi firemonkey tlistview delphi-10.2-tokyo


【解决方案1】:

为了给某一列着色,并且对于每一行,有必要将以下代码放在事件 onUpdateObjects 上。

procedure TfrmMeni.lvKorektivnoUpdateObjects(const Sender: TObject;const AItem: TListViewItem);
begin

TListItemText(AItem.Objects.FindDrawable('txtPK') as TListItemText).TextColor:= TAlphaColorRec.Gold;

end;

【讨论】:

    猜你喜欢
    • 2016-09-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-17
    • 2020-08-29
    • 1970-01-01
    相关资源
    最近更新 更多