您的位置:首页 > 其它

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

2012-09-13 18:06 459 查看
今天试验了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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: