1

I have a webView that is contained within a scrollView. Everything is then contained within a viewPager. When I fling to the next view page, the links that are in the middle of the page are being focused (highlighted with orange around the text). This causes the page to jump down to the nearest link.

Is there a way to disable links from being focusable on touch? I've tried all the settings for the webView such as focusable = false, clickable = false, focusable in touch mode = false, and nothing seems to be working.

3 Answers 3

3

I managed to do it programmatically like so:

WebView myWebView = (WebView) storyItem.findViewById(R.id.myWebView); myWebView.setFocusableInTouchMode(false); myWebView.setFocusable(false); 

This makes the links non-focusable, which solved my problem!

Sign up to request clarification or add additional context in comments.

1 Comment

hi u have idea about webclient class of webview?i have to load map image in webview and in html content i add cordinates of map area so when i toch on particular area so it navigate on screen have you any idea about this?
2
 webView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return true; } }); 

Comments

1
Webview.setWebViewClient(new WebViewClient(){ @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { return true; } }); 

This prevents the webview from opening any links and will also allow you to navigate the page without problems

1 Comment

Actually, shouldOverrideUrlLoading should return true, not false. Returning false tells the WebView to continue loading the clicked URL.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.