简体   繁体   中英

Android WebView fixed element doesn't respond to click

In my Android Webview I load my webpages. These pages has Adsense in different parts of page. If Adsense exists inside page, click event opens Adsense link in default browser/or asks to open where. That's good.

Problem is:
- If adsense exists fixed in page (like: style="position: fixed;" , it can't be clicked. I click to Adsense in portarit and nothing happens. This is problem.
- Adsense is in front of the page. So if there exists a link behind the Adsense image, when I click adsense, them bottom link is opened. - If I rotate device to landscape Adsense can be clickable, clicking opens new browser.
- I added this z-index:9999; to adsense div. But behaviour is the same. Doesn't respond to click.

Also, I have a fixed top navbar (Twitter-bootstrap). When user scrolls down, if there exists a link behind the fixed navbar, if user clicks on navbar, webview opens the link behind the navbar.

So as far as I see, links in the background has much priority then fixed element's links. And some of the fixed elements can't be clicked in portarit ?

This problem occurs in Android 2.3.x. I don't get problem in Android 4.x

我不确定是否可行,请尝试以下操作:

webView1.requestFocus(View.FOCUS_DOWN);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM