Pergunta

I've been trying to implement RichTextEditor using Webview. Webview is loaded with content editable html. To get focus on first time I need to click more than three times on webview. And It's also loosing it's focus when we click on end of entered text or end of the line again to get focus I need to click many times.

I have done following to make it focusable.

editorWebview.setFocusableInTouchMode(true);
editorWebview.setFocusable(true);
editorWebview.requestFocus(View.FOCUS_DOWN);

and request for focus in onTouch of Custom Webview, when it lost it's focus.

switch (event.getAction())
{
    case MotionEvent.ACTION_UP:
    case MotionEvent.ACTION_DOWN:
        if (!v.hasFocus()) {
            v.requestFocus();
        }
        break;
}

NOTE: I'm running javascript to apply styles to text that entered in webview.

Please tell me what I am missing.

-Thanks

Foi útil?

Solução

I removed eval command that I used in script.Now I able to get rid of focus problem.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top