如何通过phonegap安卓插件实现复制(到剪贴板)黏贴操作

来源:互联网 发布:证件照扫描软件 编辑:程序博客网 时间:2024/05/16 08:31

今天试验了phonegap的复制(到剪贴板)黏贴操作发现还蛮好用

下面说说怎么用:

lz按照教程写了一个demo,大家可以去我qq群共享下载:250395324(自己写死了一段文字然后复制到剪贴板最后输出显示弹出屏幕

1.首先我们可以去github下载插件

https://github.com/phonegap/phonegap-plugins/tree/master/Android/ClipboardManager


2.然后按照说明的教程一步一步去配置:

The plugin creates the object window.plugins.clipboardManager with the methods

copy(str, success, fail) that copies the given string paste(success, fail) that returns the text from the Clipboard

success and fail are callback functions.

An example for copy:

window.plugins.clipboardManager.copy(    "the text to copy",    function(r){alert("copy is successful")},    function(e){alert(e)});

An example for paste:

window.plugins.clipboardManager.paste(    function(r){alert("The text in the clipboard is " + r)},    function(e){alert(e)});
demo大家可以去我qq群共享下载:250395324
原创粉丝点击