开发者

Replicate behavior of Android browser

I am writing for Android, and I can't figure out how to replicate the effect of the Android browser where the progress bar is at the top of the screen, with the webview below it, yet when you scroll down, the bar scrolls with the page.

I've tried placing both the 开发者_如何学Gowebview and the progress bar into a scrollview, but when I do that, the webview becomes completely unresponsive and will not load (or respond to any commands, for that matter).

Any help would be greatly appreciated.

Thanks!

P.S., I'm using the Eclipse IDE, and I'd like to to continue using the 1.5 SDK if possible to maintain backwards compatibility (and just to be able use my own application -- my phone isn't getting 2.1 for a couple of months).


You can achieve something similar to the progress bar in the Browser by using the Progress Bar which is available as part of the title of the Window.

Use the Activity.requestWindowFeature() method passing Window.FEATURE_PROGRESS as the argument to switch on the progress bar.

This FAQ answer has a little more detail.


I think the main thing you have to realize that WebView is not a full blown WebKit browser. IT's functionality is limited. So to address your question - WebView represents content view of the browser and it has it's own scrollbars built-in. Since you cannot nest anything inside the WebView, even if you place some control on the top of WebView and envelop these 2 with ScrollView it will still do you no good. Of course you can still use JS to add a DIV at the top and achieve similar effect but that wouldn't be trivial

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜