Search code examples
androidlistviewdelphifiremonkey

Trimming dynamic listview Text object


I have a Dynamic ListView loading some data. One of the items is a string in a TextObject.

I am trying to set the Text Trimming for this text object to Character. I have set the properties in the Object Inspector set to WordWrap: True and Trimming: Character.

On Android, it seems to do nothing, the text continues untrimmed (on Windows, it works fine, and I see the three dots like this: ...). I thought perhaps I need to do the trimming in code, so I have done this:

procedure TfrmJob.lvWorksheetsUpdateObjects(const Sender: TObject;
  const AItem: TListViewItem);
var
  TextObj: TListItemText;
begin
  TextObj := AItem.Objects.FindDrawable('Description') as TListItemText;
  TextObj.Trimming := TTextTrimming.Character;
end;

On Android, this code still does not trim the text at all, as before it just keeps going and overflows.

Am I doing something wrong?


Solution

  • This is expected behavior. per the TTextTrimming (and TText.Trimming) documentation:

    Note: For Android and iOS platforms, Trimming works only when WordWrap = False.

    But, you have WordWrap set to True instead.