Mark,

I think I had this problem myself and could solve it by using the 
following code:

        webView.setOnTouchListener(new View.OnTouchListener() {
            public boolean onTouch(View v, MotionEvent event) {
                switch (event.getAction()) {
                    case MotionEvent.ACTION_DOWN:
                    case MotionEvent.ACTION_UP:
                        if (!v.hasFocus()) {
                            v.requestFocus();
                        }
                        break;
                }
                return false;
            }
        });

Hope this would help,
Sergey

Fred Grott(shareme) wrote:
> Webview would have two touch events already as you would have the
> onClickListener which would have touch up touch down
>
> Were you getting those two events before adding OnTouchListener?
>
>
>
> On Feb 5, 9:46 am, Mark Nuetzmann <mark.nuetzm...@gmail.com> wrote:
>   
>> I just tried adding an OnTouchListener to the webview and I get ALL
>> the touch events.  However, the links in the webview to not appear
>> selected/focused...  This seems really weird to me.  Anyone have an
>> idea why I would receive an OnTouch event for the view but the view
>> itself does not seem to respond to those events?
>>
>> On Feb 5, 9:36 am, Mark Nuetzmann <mark.nuetzm...@gmail.com> wrote:
>>
>>     
>>> I have an Activity that has a WebView that contains some simple html
>>> that allows me to display a Terms & Conditions link that if touched or
>>> clicked calls another activity.  My problem is unless the link in the
>>> WebView has focus (ie, the text is wrapped with that little orange
>>> focus) I cannot touch the link and have it work.  If any other view on
>>> the activity has focus, touching the WebView with the link does
>>> nothing.  The other Views that had focus loose focus, but the WebView
>>> does not receive focus.  I have tried calling setFocusable(true) and
>>> setFocusableInTouchMode(true) but that does not do any good...
>>>       
>>> I would really like to know what you have to do to get a WebView to
>>> respond to touch events without using the trackball to scroll to the
>>> view before touching it.
>>>       
>>> thank you,
>>> Mark
>>>       
>>     
> >
>
>   


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to