6String_Coder 6String_Coder - 1 year ago 275
Android Question

FireMonkey TListView click/press behaviour

I have a Firemonkey Listview in an app running on both iOS and Android. The listview contains 5 items.

One thing I've noticed is when I press the list view with my finger but not on an actual item (in the blank space below the last item), it still selects/highlights the last item in the listview.

Is there anyway of preventing this?


Answer Source

The issue is in the FMX.ListView.pas unit file.

There is a function called

function TCustomListView.FindItemAbsoluteAt(ViewAt: Integer): Integer;

Need to replace

if ViewAt >= FHeightSums[FHeightSums.Count - 1] then
Exit(FHeightSums.Count - 1);


if ViewAt >= (FHeightSums[FHeightSums.Count - 1] + GetItemHeight(FHeightSums.Count - 1)) 
then Exit(-1);

Once this has been changed, save and add the unit file to your project and it should work.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download