views:

43

answers:

1

I would like to have a linearlayout with a header section on top and a webview below. The header will be short and the webview may be longer and wider than the screen.

What is the best way to get horizontal and vertical scrolling? Is a ScrollView nested inside a HorizontalScrollView a good idea?

A: 

Is a ScrollView nested inside a HorizontalScrollView a good idea?

Yes, and no.

Yes, my understanding is that ScrollView and HorizontalScrollView can be nested.

No, AFAIK, neither ScrollView nor HorizontalScrollView work with WebView.

I suggest that you have your WebView fit on the screen.

CommonsWare
I can say for certain that a ScrollView and HorizontalScrollView can be nested as I've done it, but the user experience is poor as it can be difficult to make it scroll in the direction you want it to, and there is no diagonal interpretation--you either get all vertical or all horizontal movement.
Blumer
"have your WebView fit on the screen." Unfortunately I do not have any way to do that :(
cjavapro
@Blumer I noticed. That is acceptable for me but not optimal.
cjavapro
@cjavapro: "Unfortunately I do not have any way to do that" -- what is stopping you?
CommonsWare
The pages are user generated and if it contains a long line of dashes or an image it would be too wide and if it had too much content it would be too long.
cjavapro
@cjavapro: So? `WebView` scrolls internally, like a regular Web browser.
CommonsWare
Oh - well that is a good thing.. I will try it today, thanks.
cjavapro
I was able to use width fill_parent and height wrap_content on the web view. When the web view is a child of a vertical linear layout which is a child of a scroll view, the vertical scrolling applies to the whole linear layout and the horizontal is only on the web view, the diagonal does not work. I may put everything in the WebView to get diagonal scroll but that is not likely.
cjavapro