开发者

How to select text from a webview and not copy it?

I am creating an application which requires a webview.

I want to enable text selection in webview. (I found a few solutions but none of them worked)

Once the webview is selected, it should not be directly copied. I should be able to expand the selection range with handles (It is possible in versi开发者_开发技巧on 2.3 and later. But I want this on versions lower than 2.3. HTC's browser gives us this option)

Any idea?


recently i solved that

put this function on create or on load in activity

private void emulateShiftHeld(WebView view)
{
    try
    {
        KeyEvent shiftPressEvent = new KeyEvent(0, 0, KeyEvent.ACTION_DOWN,
                                                KeyEvent.KEYCODE_SHIFT_LEFT, 0, 0);
        shiftPressEvent.dispatch(view);

    }
    catch (Exception e)
    {
        Log.e("dd", "Exception in emulateShiftHeld()", e);
    }
}

it will done...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜