从文本选择工具接口(其中,复制/粘贴) [英] Interface from text selection tool (where copy/paste is)

查看:186
本文介绍了从文本选择工具接口(其中,复制/粘贴)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在android系统添加一个按钮,当用户选择的文本,然后单击上下文按钮(例如,它显示复制,剪切,粘贴,全选)。是否有人可以告诉我去图书馆或一些资源,我可以潜在地了解这一点?

试图寻找它,我有点失去了,因为我真的不知道从哪里开始。难道Android的提供了直接的库来访问呢?如果是这样,在什么命名空间可能我觉得这些功能呢?

感谢您!


解决方案

  

我想在android系统当用户选择文本然后点击按钮背景下添加一个按钮(例如,它显示复制,剪切,粘贴,全选)。


有在Android的没有背景按钮。

在一个的EditText 部件,剪切,复制,粘贴,全选显示在以下三种方式:


  1. 通过上下文菜单。您可以尝试通过 onCreateContextMenu菜单项添加到此菜单()


  2. 通过在Android上的动作模式3.0+。您可以拨打 setCustomSelectionActionModeCallback()的EditText 来增加新项目的操作模式。请注意,动作模式并不总是显示,由于无论是错误或一种莫名其妙的UI决定。


  3. 通过别的东西,如一些的Andr​​oid 2.x的设备制造商选做自己的事情了剪切/复制/粘贴与的EditText 这不是一个上下文菜单。


I would like to add a button in android when a user selects texts then clicks the context button (e.g. it shows copy, cut, paste, select all). Can someone please direct me to the libraries or some resource where I can potentially learn about this?

Trying to search for it, I'm kind of lost because I really don't even know where to start. Does android provide a direct library to access this? If so, in what namespace might I find these functions?

Thank you!

解决方案

I would like to add a button in android when a user selects texts then clicks the context button (e.g. it shows copy, cut, paste, select all).

There is no "context button" in Android.

On an EditText widget, "Cut, Copy, Paste, Select All" is displayed in one of three ways:

  1. Via a context menu. You can attempt to add menu items to this menu via onCreateContextMenu().

  2. Via an action mode on Android 3.0+. You can call setCustomSelectionActionModeCallback() on the EditText to add new items to the action mode. Note that the action mode is not always displayed, due to either a bug or an inexplicable UI decision.

  3. Via something else, as some Android 2.x device manufacturers elected to do their own thing for cut/copy/paste with an EditText that is not a context menu.

这篇关于从文本选择工具接口(其中,复制/粘贴)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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