如何在Android的Google(设备)本机应用程序上添加自定义按钮? [英] How to add the custom button on google's(device) native application in android?

查看:109
本文介绍了如何在Android的Google(设备)本机应用程序上添加自定义按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在google(设备)的本机应用程序Like(Google Map)上添加一个按钮,使用此按钮我要打开我的应用程序.

I want to add one button on google(device)'s native application Like(Google Map),Using this button I want to open my application.

我已经为此做了一些工作.

I have do some work regarding that.

  • 使用 AccessibilityService ,我发现哪个应用程序仍在使用该程序运行服务我使用SYSTEM_ALERT_WINDOW权限打开独立对话框.但是对话框覆盖了整个屏幕,我设法在屏幕底部显示了该对话框,但是我仍然无法在设备本机应用程序(如Google Map)中执行任何操作,因为我的对话框包含这些触摸, 我使用终端检查了活动堆栈,发现我的应用程序仍然位于堆栈的顶部.
  • Using AccessibilityService I find the which application still running using this service I open the stand alone dialog using SYSTEM_ALERT_WINDOW permission. But the dialog cover whole screen , I manage to display this dialog in screen bottom side, but still I can't do anything in device native application like (google map), because my dialog is contain those touch, I checked the activity stack using terminal ,I found that still my application is top of the stack.

现在经过两天(周六/周日)研究,我找不到与此相关的任何合适解决方案.

Now After two day (Saturday/Sunday) research I can't find the any suitable solution regarding this.

我被困住了.

推荐答案

根据我的理解,您希望在Google应用程序顶部显示一个用户界面,但是一旦您的用户界面被唤醒,您就无法将触摸信息发送给Google您在其中引发了UI的应用程序,这非常明显,因为现在重点放在您的UI上.我建议您使用服务,并将您的UI绑定到它,并使用带有适当标志的WindowManager.LayoutParams.您可以点击此链接

As per my understanding, you want to show a UI on top of google application but once your UI is evoked you are not able to send the touch to the google application over which you evoked your UI which is very obvious as focus is now on your UI. I'll suggest you to use a Service and bind your UI to it and use WindowManager.LayoutParams with appropriate flags. You can follow this link

https://github.com/henrychuangtw/Android-ChatHead/blob/master/app/src/main/java/henrychuang/tw/chatheadmsg/ChatHeadService.java

了解操作方法.不必使用聊天头UI,而必须使用UI.

to get an idea how to do it. Instead of chathead UI you have to use your UI.

这篇关于如何在Android的Google(设备)本机应用程序上添加自定义按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆