在编辑文本行为的Andr​​oid龙preSS [英] Android Long Press on Edit Text behavior

查看:141
本文介绍了在编辑文本行为的Andr​​oid龙preSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能添加一些项目列表中,显示了当任何编辑文本用户长时间presses? (剪切,复制粘贴,选择文本,全选,输入法),我想补充一个选项,这将扫描QR code和结果粘贴到编辑文本。我想这不会是很难得到这种行为进行编辑的文本,我把我的自己的应用程序中,但我想这个选项添加到里面的我的手机上的任何应用程序的任何编辑文本。是这样的可能,如果是这样任何人都可以点我在正确的方向?

Is it possible to add something to the list of items that shows up when a user long presses on any Edit Text? (Cut, copy paste, select text, select all, input method) I want to add an option to this that will scan a QR code and paste the result into the Edit Text. I think this would not be very hard to get this behavior out of Edit Texts that I put into my own application, but I am wanting to add this option to any Edit Text inside any application on my phone. Is something like this possible, if so can anyone point me in the right direction?

编辑150赏金:我期待的项目添加到EditText上弹出对话框,当它长pressed。我想我在寻找一种方法,使这一变化全系统,不只是1个应用程序的范围内。

Edit 150 bounty: I am looking to add an item to the EditText pop-up dialog when it is long pressed. I want am looking for a way to make this change system wide, not just within the context of 1 application.

推荐答案

那不可能的,因为在上下文菜单是通过应用填充本身,而不是由系统。你不能强迫其他应用程序有一个背景的项目,他们可能不会在有生之年使用。您可以ATLEAST必须在了解您的应用程序的应用程序的功能。

创建填充和只处理全局菜单项的活动。其他应用程序可以通过扩展您的活动使用该功能。然而,这也将产生问题,因为其他应用程序将在您的应用程序hard依赖关系。所以,如果您的应用程序未安装在系统中,然后其他的应用程序将无法正常工作。也没有办法来表示这种依赖关系在清单文件,使得相关的应用程序隐藏在市场上,如果尚未安装您的应用程序。

我敢肯定这是不是你要找的答案,但上下文菜单是由设计制作等等。

Thats not possible, as the context menu is populated by applications themselves and not by the system. You cannot force other apps to have a context item that they might not use in their lifetime. You can atleast have the feature in apps that are aware of your app.

Create an activity that populates and handles only your global menu items. Other apps can use the feature by extending your activity. But this too will create problems, as the other apps will have a hard dependency on your app. So if your app is not installed in that system then the other app won't work. Also there is no way to indicate of this dependency in the manifest file so that the dependent app is hidden in the market if your app is not already installed.

I'm sure this is not the answer you were looking for, but context menus are made so by design.

这篇关于在编辑文本行为的Andr​​oid龙preSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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