views:

40

answers:

1

Hello, I'am looking for a way to have a webview content selectable in the very same way as the stock browser does.

  • user long presses the text
  • the whole word is selected
  • two pins appear at the word's boundary allowing the user to stretch/shrink the selection.

I should note that Dolphin HD shows exactly the same text select functionality as the default browser (same icons, animation, etc), so it really should be possible. But I can't figure out how.

Until now, all i found was this function, which kind of work, but doesn't allow the user to expand/shrink the selection.

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

EDIT: I just discovered that long touch copy/paste is part of HTC Sense, not Stock android. Still, it'd be useful to find out how to enable that on a webview, even just for HTC users. Anybody knows ?

A: 

Also awaiting for a clean solution as you do!

fuyicong