Android. Fit webview size to youtube video size -


i'd play youtube video using android webview. but want fit webview youtube video size. until now, implementaion below.

        string vid = textutils.extractyoutubevid(body);         if (stringutils.isblank(vid)) {             return null;         }          string html = "<html > <head></head> <body style=\"margin:0 0 0 0; padding:0 0 0 0;\"> <iframe width=\"100%\" height=\"100%\" src=\"http://www.youtube.com/embed/___\" frameborder=\"0\"></iframe> </body> </html> ";         html = html.replace("___", vid);          mimportedvideowebview.setwebchromeclient(new webchromeclient());         websettings websettings = mimportedvideowebview.getsettings();         websettings.setjavascriptenabled(true);         mimportedvideowebview.loaddata(html, "text/html", "utf-8"); 

mimportedvideowebview webview , width match_parent , height 350dp.

by using above code, can play youtube video.

but, want put webview width screen width , fit webview's height youtube video height proportionally. me plz!

thanks!

you can use:

webview.getsettings().setloadwithoverviewmode(true); webview.getsettings().setusewideviewport(true); 

Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -