Android的添加项目到全球范围内的菜单范围内、菜单、项目、全球

2023-09-06 06:04:02 作者:思念入骨

当的东西在你的Andr​​oid长期preSS,上下文菜单出现。我想要的东西添加到这个上下文菜单中的所有 TextViews 在系统中。

When you long press on something in Android, a context menu comes up. I want to add something to this context menu for all TextViews in the system.

例如,该系统做到这一点与复制和粘贴。我想补充我自己的,有它出现在每个应用程序。

For example, the system does this with Copy and Paste. I would want to add my own, and have it appear in every application.

推荐答案

目前Android不支持这一点,你不能覆盖或不执行,你暴露的意图或活动的特定活动的系统级挂钩全球范围内的功能。甚至在出版的意图,将没有关系,除非正在运行的应用程序的情况下,是一个消费者...和所有的基本系统程序,显然不会没有更新该应用消耗前你的所有应用程序。

Currently Android does not support this, you cannot override or hook functionality globally at the system level without the particular activity implementing an intent or activity that you expose. Even in the case of publishing an intent it wouldn't matter unless the application running is a consumer... and all the base system applications and obviously all applications prior to yours would not be without updating the app to consume.

基本上,因为它代表,这是不可能的。

Basically as it stands, this is not possible.

究竟是什么你试图完成这一全球性上下文菜单中,某种全​​球性的搜索或发送到贯穿你的应用程序的功能?

What exactly are you trying to accomplish with this global context menu, some sort of global "Search For" or "Send To" functionality that runs through your application?