Android ScrollView containing LinearLayout with WebView scroll behavior?

You cannot reliably put a WebView in a ScrollView .

Up vote 2 down vote favorite 1 share g+ share fb share tw.

I have a view hierarchy like this, a vertical ScrollView with a vertical LinearLayout containing two children: ScrollView ->orientation:vertical, width:fill_parent, height: fill_parent LinearLayout -> orientation:vertical, width:fill_parent, height: fill_parent WebView -> width:fill_parent, height: fill_parent GoogleAdView -> width:wrap_content, height:wrap_content When scrolling to the bottom of the webview and clicking on any link there, though the page loads , the scrollbar stays at the bottom rather than moving to the top. I can programatically set the scroll using scroll. FullScroll(ScrollView.

FOCUS_UP), but that causes the scrollbar to jump up visibly. I have tried hiding the scrollbar before the page loads with scrollView. SetVerticalScrollBarEnabled(false) and then re-enabling it after the page loads before calling scroll.

FullScroll(ScrollView. FOCUS_UP) but that still causes the scrollbar to "jump". The WebView by itself handles scrolling much more nicely on page changes, looks like it hides the scrollbar and then makes it appear on top of the page after load.

Is there a way to maintain this with ScrollView? Android android-webview android-scrollview link|improve this question edited Jun 9 '11 at 22:25Brian Mansell703318 asked Jun 9 '11 at 11:48gavans111.

You cannot reliably put a WebView in a ScrollView. Either embed your ad in your Web content, leave the banner fixed on the screen, or work out some other trigger to animate hiding the ad (e.g. , goes away after 5 seconds).

I've solved this by adding the AD inside the webview. Unfortunately you won't be able to use any Ad network SDK's, but it's a much better user experience. Use javascript injection to insert your ads after the webview loads.

The trick is to use loadDataWithBaseURL when loading content into the WebView. Simply doing a loadData doesn't cause the scroll offset to reset.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions