android - 手势不适用于 Android 上的 ListView 项目
问题描述
我想对 FireMonkey 多设备应用程序中的项目使用“LongTap”和“PressAndTap”手势,我TListView
设置了如下OnGesture
事件:ListView
begin
case EventInfo.GestureID of
igiPressAndTap : begin
{...}
end;
igiLongTap : begin
{...}
end;
end;
Handled := True;
end;
但是当我在 Android 设备上测试它时,OnGesture
事件没有发生
我已经在InteractiveGestures
财产上检查了我想要的手势
我已经测试过有或没有GestureManager
如何为 Listview 的项目设置 OnGesture?
没有任何类似OnGesture
forTListViewItem
类型的事件
我正在使用 Delphi 10.2.3 Tokyo
解决方案
我按照 Tom 提供的链接中的说明测试了一个应用程序,您需要在 Object Inspector 的 Touch 属性中设置所需的手势。
在 OnGesture 事件中,代码只是检查 GestureID 是否是我想要执行的手势。
procedure TfrmMain.listProdtsRotaGesture(Sender: TObject;
const EventInfo: TGestureEventInfo; var Handled: Boolean);
begin
case EventInfo.GestureID of
igiLongTap:
ShowMessage('longTap: ' + listProdtsRota.Selected.Index.ToString);
igiPressAndTap:
ShowMessage('pressAndTap: ' + listProdtsRota.Selected.Index.ToString);
igiDoubleTap:
ShowMessage('doubleTap: ' + listProdtsRota.Selected.Index.ToString);
end;
end;
推荐阅读
- powershell - 获取 powershell 脚本的位置,可选择通过符号链接
- python - 如何使这个numpy数组的初始化工作?
- regex - 如何在正则表达式中至少一次从集合中无序选择每个元素?
- r - R:ggplot - 根据组绘制具有不同颜色的数据点的趋势线
- c# - ASP.NET Core AuthorizationHandler 未被调用
- python - AWS lambda 调用时不运行代码
- javascript - 未更新使用 JavaScript 的密码确认
- docker - Gitlab 使用 helm 安装分蘖导致 kubernetes-charts.storage.googleapis.com 不是有效的图表存储库
- javascript - displayChoice() 和使用 .innerHTML 有什么区别?
- c# - 如何将对象列表投影到嵌套对象列表中