Android WebView One Column doesn't work with Y

2019-07-26 17:02发布

问题:

I am loading RSS data from URL,and that RSS data can contain link to YouTube video.

Here is an example how link to youtube vide looks like:

div class="video-shortcode"><iframe title="YouTube video player" width="600" 
height="350" src="http://www.youtube.com/embed/HXrcUyCVA6c"
frameborder="0" allowfullscreen></iframe></div>

When I use this code, I get preview of YouTube video and I can play it, but images are to large as shown on the image below.

I used this code for WebView:

WebView desc;

WebSettings ws = desc.getSettings();

ws.setLayoutAlgorithm(LayoutAlgorithm.NARROW_COLUMNS);

When I tried to use this code for WebView:

ws.setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);

It seems that YouTube videos dont work, because they are black, and I can't play them.

Looks like this: