安卓设备或电视设备加载html文件后,显示不全

福尔摩斯对我笑 2019-05-14 23162 次 2226条

最近项目中使用安卓的webview控件将html文件加载到电视和win的设备上,经过测试,发现在一张1920*1080的html文件,在win上可以正常显示,在电视屏幕上显示不全

问题排查

  • 安卓是否设置为自动适应屏幕,是否支持缩放,然而设置后发现还是不正常,继续
//适应屏幕
webView.getSettings().setUseWideViewPort(true);
webView.getSettings().setLoadWithOverviewMode(true);


webView.setVisibility(View.VISIBLE);
webView.setBackgroundColor(0);
webView.getSettings().setAllowFileAccess(true);// 设置允许访问文件数据webView.getSettings().setSupportZoom(true);//支持放大网页功能webView.getSettings().setBuiltInZoomControls(true);//支持缩小网页功能


  • 查看html页面中是否设置meta标签,经查证设置了该标签,并支持缩放,然而还是不行

<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />

  • 后来去掉了meta标签后,竟然正常了,所有设备测试通过.

原因如下:meta viewport 标签之前,layout viewport 宽度是浏览器默认的(大部分浏览器、WebView都默认为这个值)。meta viewport 标签之后,因为指定了 initial-scale=1,所以浏览器将 layout viewport 宽度设为 visual viewport(可视区域) 的宽度,其它一系列的 width 也跟风进行变动。

https://landchanning.github.io/2018/01/25/webview_viewport/

具体关于viewport的说明请查看 https://www.cnblogs.com/2050/p/3877280.html

标签: 无

非特殊说明,本博所有文章均为博主原创。

头像也是LOGO
未来博客 博主大人
到了这个年纪,不应该再彷徨!

kd 11 shoes进行回复 Cancel Reply



 


已有 2226 条评论 1


  1. moncler coat

    Thank you for every one of your hard work on this web site. My mom loves going through investigations and it’s obvious why. My partner and i know all regarding the compelling means you convey worthwhile tactics on the web blog and therefore welcome response from the others about this subject then my simple princess has been studying so much. Enjoy the remaining portion of the year. You’re performing a great job.

    回复 2019年11月2日
  2. louboutin shoes

    I would like to express some thanks to the writer for bailing me out of this particular condition. Right after researching throughout the world-wide-web and getting tips which are not pleasant, I believed my life was done. Being alive without the strategies to the difficulties you’ve fixed by means of your write-up is a serious case, as well as ones which might have badly affected my entire career if I hadn’t encountered your blog post. Your good training and kindness in taking care of the whole lot was very useful. I don’t know what I would have done if I hadn’t come upon such a subject like this. I can also now relish my future. Thank you very much for the specialized and sensible help. I will not hesitate to suggest your web site to any person who would need recommendations on this issue.

    回复 2019年11月2日
  3. cheap jordans

    I would like to show my gratitude for your kindness supporting those individuals that absolutely need assistance with that area. Your real commitment to getting the solution all over had been especially important and have constantly helped professionals just like me to arrive at their pursuits. Your warm and friendly guideline means a whole lot to me and somewhat more to my office workers. Thank you; from all of us.

    回复 2019年11月1日
  4. balenciaga shoes

    I not to mention my guys were actually examining the excellent hints on your web blog and instantly got a terrible suspicion I never expressed respect to the web blog owner for those tips. All the young men are already totally very interested to see them and have now without a doubt been taking pleasure in those things. Appreciate your getting really kind and then for using this form of very good subject matter most people are really eager to discover. My personal sincere apologies for not saying thanks to earlier.

    回复 2019年10月31日
  5. curry 5

    I actually wanted to develop a simple word to say thanks to you for all the magnificent tips you are writing here. My particularly long internet search has finally been honored with good facts and strategies to go over with my visitors. I would assert that most of us visitors are very endowed to exist in a wonderful website with very many wonderful people with great ideas. I feel really privileged to have come across your entire website page and look forward to many more pleasurable moments reading here. Thank you once more for everything.

    回复 2019年10月30日
  6. adidas stan smith

    My wife and i ended up being quite comfortable Jordan managed to conclude his researching through your ideas he discovered through your web site. It is now and again perplexing just to be giving freely things which other people could have been selling. And we consider we now have you to be grateful to for this. These explanations you’ve made, the simple site menu, the friendships you can help to foster – it’s got most fabulous, and it is making our son and our family understand the theme is thrilling, and that’s particularly important. Thank you for all the pieces!

    回复 2019年10月28日
  7. nike basketball shoes

    I definitely wanted to write down a quick remark to thank you for the lovely recommendations you are giving at this website. My time-consuming internet research has now been compensated with excellent knowledge to exchange with my colleagues. I ‘d mention that most of us site visitors are unquestionably lucky to live in a magnificent network with many marvellous people with insightful principles. I feel quite grateful to have encountered your entire webpage and look forward to tons of more thrilling moments reading here. Thanks again for a lot of things.

    回复 2019年10月25日
  8. cheap jordans

    A lot of thanks for your entire efforts on this website. Betty takes pleasure in managing investigation and it is simple to grasp why. All of us hear all relating to the lively manner you make worthwhile ideas on this web site and therefore attract contribution from the others on this concern while my child is certainly being taught so much. Have fun with the remaining portion of the new year. You have been carrying out a good job.

    回复 2019年10月24日
  9. golden goose

    I have to voice my admiration for your kind-heartedness giving support to individuals that have the need for guidance on this important area of interest. Your very own dedication to passing the solution all over appears to be wonderfully functional and has truly made professionals like me to attain their dreams. Your useful report denotes much a person like me and even more to my fellow workers. Thanks a ton; from all of us.

    回复 2019年10月23日
  10. christian louboutin outlet

    I and my guys appeared to be looking through the good strategies found on your web page and then developed an awful suspicion I had not thanked the web site owner for those techniques. All the young men became certainly excited to learn them and now have truly been using these things. Appreciate your really being quite thoughtful and also for obtaining this form of incredibly good things most people are really needing to learn about. Our own honest regret for not expressing gratitude to sooner.

    回复 2019年10月22日
  11. yeezy boost 350 v2

    I want to show thanks to the writer just for bailing me out of this crisis. As a result of exploring through the search engines and obtaining opinions which were not pleasant, I figured my entire life was gone. Living without the approaches to the issues you’ve resolved all through your main article content is a crucial case, and the kind which might have negatively affected my career if I had not noticed your web site. Your own know-how and kindness in handling all the stuff was useful. I am not sure what I would’ve done if I had not discovered such a stuff like this. I can now look forward to my future. Thanks a lot very much for your expert and sensible help. I won’t think twice to propose your web site to anyone who would need guide on this area.

    回复 2019年10月22日
  12. balenciaga shoes

    I want to convey my affection for your kind-heartedness giving support to women who require help on your content. Your personal commitment to getting the message all-around has been really insightful and has always enabled regular people just like me to reach their dreams. This warm and friendly publication entails so much to me and even more to my mates. Regards; from each one of us.

    回复 2019年10月21日
  13. nfl jerseys

    I needed to put you one bit of word to be able to say thanks once again for these exceptional tips you have documented on this website. It has been so extremely generous of people like you to make without restraint all that many individuals would’ve made available for an e book in making some bucks for themselves, mostly now that you might well have tried it if you considered necessary. Those suggestions also served to become good way to realize that someone else have the same passion really like my very own to know a little more on the topic of this issue. I know there are several more pleasant moments ahead for folks who read your blog post.

    回复 2019年10月20日
  14. nike air max 2017

    I enjoy you because of every one of your hard work on this blog. My niece really loves doing internet research and it’s easy to understand why. All of us know all relating to the dynamic form you produce both interesting and useful suggestions via your web blog and even encourage contribution from other individuals on the idea then our own princess is now understanding a lot. Take advantage of the remaining portion of the new year. You are performing a fabulous job.

    回复 2019年10月19日
  15. hermes birkin bag

    I wish to convey my love for your kindness in support of folks that need help with this particular concern. Your personal commitment to passing the solution throughout had become particularly invaluable and have surely enabled regular people much like me to get to their ambitions. Your personal helpful facts can mean a whole lot a person like me and much more to my mates. Thanks a ton; from all of us.

    回复 2019年10月18日
  16. christian louboutin shoes

    Thank you so much for giving everyone a very special possiblity to read critical reviews from here. It is always so pleasing and as well , full of amusement for me personally and my office fellow workers to search the blog really three times every week to study the latest secrets you have got. And definitely, I’m just at all times astounded with the spectacular tricks you give. Certain 1 points in this post are ultimately the most impressive I have ever had.

    回复 2019年10月17日
  17. kobe shoes

    I actually wanted to type a quick comment so as to express gratitude to you for all the fabulous ways you are posting here. My particularly long internet investigation has now been rewarded with reasonable information to exchange with my contacts. I ‘d repeat that many of us readers actually are really lucky to live in a decent website with so many brilliant people with insightful plans. I feel somewhat fortunate to have seen the web page and look forward to some more fun minutes reading here. Thanks a lot once again for everything.

    回复 2019年10月16日
  18. jordan shoes

    Thank you for all of your labor on this web site. My mother really likes carrying out investigation and it’s easy to see why. A number of us know all concerning the powerful tactic you create great strategies through this web site and as well increase contribution from other individuals on this content while our child is truly being taught so much. Enjoy the rest of the new year. You have been performing a superb job.

    回复 2019年10月15日
  19. golden goose outlet

    I intended to post you this little observation to finally thank you very much as before just for the remarkable knowledge you’ve documented on this page. This has been certainly remarkably generous with people like you to supply easily what a lot of people might have made available as an e-book to make some cash for themselves, principally considering that you might have tried it if you desired. The thoughts additionally acted as the great way to fully grasp that other people have the same fervor the same as my very own to find out much more in regard to this problem. I know there are some more enjoyable sessions up front for people who read your blog.

    回复 2019年10月14日
  20. nike air max 90

    My wife and i ended up being so thankful when Raymond could finish up his survey through your ideas he had out of the site. It’s not at all simplistic to simply choose to be releasing tips and tricks many others could have been making money from. Therefore we already know we have got you to thank for this. The specific illustrations you have made, the straightforward blog navigation, the relationships you can make it possible to promote – it’s got mostly powerful, and it’s really leading our son and the family know that this theme is satisfying, which is tremendously important. Many thanks for all the pieces!

    回复 2019年10月13日
  21. supreme clothing

    I precisely wanted to appreciate you all over again. I do not know the things that I might have gone through without the entire basics revealed by you concerning this subject. It actually was a real frightening case in my opinion, however , taking note of the specialised approach you treated it made me to jump with happiness. I’m happy for this work and expect you recognize what a powerful job you were undertaking instructing people today by way of your web site. I’m certain you haven’t encountered any of us.

    回复 2019年10月12日
  22. cheap jordans

    I precisely wished to appreciate you yet again. I’m not certain the things I could possibly have sorted out without the type of secrets provided by you on such theme. It became a depressing situation in my position, nevertheless coming across this professional tactic you treated the issue forced me to cry over delight. Extremely thankful for the support as well as have high hopes you are aware of an amazing job you’re accomplishing training the others with the aid of your webpage. Most probably you have never come across all of us.

    回复 2019年10月12日
  23. golden goose sneakers

    My wife and i felt now lucky that Albert could complete his investigations from your precious recommendations he discovered through your web page. It’s not at all simplistic just to always be freely giving guidelines which often the others may have been making money from. And we also realize we have got you to thank because of that. The specific explanations you made, the simple web site navigation, the friendships you will give support to create – it is mostly powerful, and it is assisting our son and our family do think this article is enjoyable, which is certainly rather essential. Thanks for all the pieces!

    回复 2019年10月11日
  24. air max 270

    I as well as my pals came studying the nice techniques on your web blog then instantly I got a horrible feeling I never thanked the site owner for those tips. All the men came totally passionate to see all of them and have now in truth been tapping into them. Appreciation for turning out to be quite helpful and then for obtaining varieties of fabulous guides most people are really eager to know about. Our own sincere apologies for not expressing appreciation to earlier.

    回复 2019年10月10日
  25. bape hoodie

    I wanted to send you one bit of word to be able to say thanks a lot as before for your lovely ideas you’ve contributed on this page. It was so seriously open-handed with you to offer unhampered what most of us would have offered as an e book to generate some bucks for their own end, particularly considering that you could have tried it if you decided. Those thoughts in addition served to provide a great way to be sure that many people have the identical dream just as my very own to realize significantly more with respect to this problem. I’m certain there are several more fun periods ahead for folks who read through your website.

    回复 2019年10月9日
  26. nike air vapormax

    I as well as my friends have already been analyzing the best advice located on your web site and then the sudden came up with a horrible feeling I never expressed respect to the blog owner for those tips. Those boys were definitely consequently warmed to see them and now have in reality been making the most of these things. I appreciate you for turning out to be quite considerate and also for deciding upon this kind of awesome topics millions of individuals are really eager to be informed on. My personal honest regret for not saying thanks to earlier.

    回复 2019年10月8日