目录

点击拍照按钮后,页面上所有按钮点击无效

问题现象

点击拍照按钮后,再点击页面上的其他内容,均无响应。

背景知识

问题定位

  1. 在hilog日志中搜索关键字Click accepted,在06:47:02.067点击了拍照按钮。
    05-22 06:47:02.067 51708 51708 I C03945/com.hx.example/AceStateStyle: [(100000:100000:scope)] Find customNode by self: CameraPage
    05-22 06:47:02.067 51708 51708 I C0391E/com.hx.example/AceGesture: [(100000:100000:scope)] Click try accept
    05-22 06:47:02.067  1054 50298 I C02BA5/CameraDaemon/PackageAckExcuter: T:8 OnRequestAck<133>: cameraId0(202) reqType(1-) targetMap(0x8604000) status(0) ts(113312041453us)
    05-22 06:47:02.067 51708 51708 I C03951/com.hx.example/InputKeyFlow: [(100000:100000:scope)] Click accepted, tag: Text
  2. 搜索关键字touch test,在点击拍照按钮之后,后续的点击事件被Text组件接收。
    05-22 06:47:20.583 51708 51708 I C03951/com.hx.example/InputKeyFlow: [(100000:100000:scope)] InputTracking id:68948, touch test hitted node info: fingerId: 0{ tag: Text, depth: 7 };
    05-22 06:47:20.583 51708 51708 I C03951/com.hx.example/InputKeyFlow: [(100000:100000:scope)] InputTracking id:68948, touch test hitted recognizer type info: recognizer type ClickRecognizer node info: { tag: Text };
  3. 对比正常的日志,点击事件应该被Image组件接收。
    07-10 11:16:10.398   61994-61994   I   [(100000:100000:scope)] InputTracking id:211547, touch test hitted node info: fingerId: 0{ tag: Image, depth: 8 };
    07-10 11:16:10.398   61994-61994   I   [(100000:100000:scope)] InputTracking id:211547, touch test hitted recognizer type info: recognizer type ClickRecognizer node info: { tag: Image };
  4. 在点击拍照按钮后,应用使用了透明的Text组件覆盖在页面上,导致所有按钮点击无效。
  5. 搜索关键字photoAvailable,没有相关日志,可以判断拍照还未结束。

分析结论

在拍照还未结束时,页面上存在透明的Text组件接收了所有点击事件,导致被覆盖的按钮点击无效。

修改建议

使用自定义弹出框代替透明的组件,提示用户正在进行拍照操作,代码可参考其中的完整示例。