Reputation: 197
I have a quite big problem with the layout of my WebView. I'm downloading content from an RSS collector site, including the article content. This content may contain pictures or YouTube videos or whatever else. Downloading is not the problem, but rather displaying it.
The pictures will probably be too wide to fit the screen. This is not a problem - I can resolve that by setting the LayoutAlgorithm to SINGLE_COLUMN
.
_webView.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
However, using SINGLE_COLUMN
creates a problem for YouTube videos. They are resized in width, but not in height - resulting in the WebView displaying only a black picture instead of the video. There is no way of playing the video like this.
I can resolve this as well by setting the LayoutAlgorithm to NORMAL
or NARROW_COLUMNS
- however, that results in the pictures not being resized to the screen size as I'd like, and I have to scroll right/left in order to see the whole picture (which does not work very well because I have the WebView in a horizontal PageAdapter).
I can assume this may be the reason SINGLE_COLUMN
is deprecated (developer.android.com). However, NARROW_COLUMNS
just does not do what I'm expecting it to.
Does anyone have any idea how to resolve this issue?
Upvotes: 1
Views: 4907