android - 有没有办法处理表面的触摸事件?

标签 android android-auto android-automotive

我想在 android-auto (AA) 导航应用程序中支持 map 拖动、缩放等。 阅读 car-lib announce 感到非常兴奋(对旧的 androidx-car 库删除有点失望:)。但是我找不到任何用户交互处理的文档和示例。

是否有任何回调或特殊管理器来处理用户与 Surface 的交互? 在 SurfaceListenerSurfaceNavigationTemplate 或文档中找不到任何相关内容。 AFAIK、Google map 和 Waze 处理缩放和旋转是因为使用旧的私有(private) Activity 提供方法(不建议屏幕提供)。

文档指出 AA 负责处理输入。不确定是否适用于导航场景。

Android Auto takes care of the following, in general: .... Input: Handling user input to templates via mechanisms available in specific cars, such as a touchscreen or rotary...

处理原始触摸事件会很酷,但如果没有计划添加它(出于安全目的或其他原因),更具体的事件似乎没问题。

interface SurfaceListener {
...
void onSurfaceScaleChanged(Float scale);
void onSurfaceRotated(Float angle);
void onSurfaceDragging(Int x, Int y);
void onSurfaceClicked(Int x, Int y);
...
}

最佳答案

这里有一个 Unresolved 问题:https://issuetracker.google.com/issues/171715013 ,谷歌对 28.dec.2020 的回答是:

This is a limitation in version 1, and we are evaluating adding this functionality for future updates.

所以我们必须等待:-)

关于android - 有没有办法处理表面的触摸事件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64442803/

相关文章:

android - Android Automotive 如何检索 obd2 数据?

android-automotive - 安装安卓汽车操作系统

java - 购买成功,但解码时出现 "Class not found": com. google.android.finsky.billing.lightpurchase.PurchaseParams

java - 无需长按即可在 recyclerView 中重新排序项目

android - 如何在android P aosp模拟器上激活汽车数据功能

android - 自动 : Showing the progress while doing a background call

安卓汽车 : Media item gets stuck "Getting your selection..." instead of showing controls while playing

android - 如何检测Android设备没有内置电池?

android - 如何从 HTML 页面打开手机摄像头?

java - unregisterListener 后仍在接收传感器事件