对于复制过程中取消/清除选定的文本上长按 [英] Deselecting/clear selected text for copy process on long click

查看:317
本文介绍了对于复制过程中取消/清除选定的文本上长按的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

**UPDATE**

实施对我的方式,我能够取消文本控件但在姜饼版本高达后。
在这种果冻已没有钥匙code组合是工作,我曾尝试与这个例子也但新版本没有更多的运气,手动调度KeyEvent的。

After implement on my way I am able to cancel text control but in gingerbread version upto. In this jelly been no keycode combination was worked I have tried with this example also but no more luck for new version to manually dispatch keyevent.

我的WebView在viewpager现在用户可以在web视图长按从web视图复制文本,但问题是,当对的WebView和光标的用户长按显示在视图中选择文本区域,他们移动左/右然后viewpager也移动。要通过这个来我有禁止对长按viewpager传呼改变事件和它的作品。

I have webview in viewpager now user can copy text from webview on long click on webview, but the problem is when user long click on webview and cursor are shown on view for selected text area and they move right/left then viewpager also move. To over come this I have disable viewpager paging change event on long click and it works.

现在,让这个和清晰/高取消对的WebView减仓文本取消复制文本过程中,我没有找到任何解决方案。

Now to enable this and clear/deselecting high lighten text on webview to cancel copy text process I didn't find any solution.

检查图这里

编辑

有谁知道怎么样我们点击右/完成按钮以编程方式取消这个进程?

Does anybody knows how to programmatically cancel this process like we click on right/done button?

这里是code开始选择的文本上的WebView中长按

here is the code start selection on text on long click of webview

public void SelectText(View v) {
    try {
        KeyEvent shiftPressEvent = new KeyEvent(0, 0, KeyEvent.ACTION_DOWN,
                KeyEvent.KEYCODE_SHIFT_LEFT, 0, 0);
        shiftPressEvent.dispatch(v);
    } catch (Exception e) {
        throw new AssertionError(e);
    }
}

现在如何取消/关闭此选项和编程减轻清晰的文本。

now how to cancel/dismiss this selection and clear lightening text as programmatically.

我已经试过同一code。与ACTION_UP以上code,但没有运气
没有任何人试图知道吗?

I have tried same code with ACTION_UP with above code but no luck does anybody tried know about this?

在此先感谢

推荐答案

有关取消

我必须这样做。

public void SelectText(View v) {
    try {
        KeyEvent shiftPressEvent = new KeyEvent(0, 0, KeyEvent.ACTION_DOWN,
                KeyEvent.KEYCODE_ESCAPE, 0, 0);
        shiftPressEvent.dispatch(v);
    } catch (Exception e) {
        throw new AssertionError(e);
    }
}

和这个工作了姜饼版本,但在4.0版中不工作,我不知道为什么这不是工作,但试图找到办法还

and this worked for gingerbread version but not working in 4.0 version I don't know why this not working but try to find way also

感谢您

这篇关于对于复制过程中取消/清除选定的文本上长按的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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