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

福尔摩斯对我笑 2019-05-14 3152 次 541条

最近项目中使用安卓的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
未来博客 博主大人
到了这个年纪,不应该再彷徨!

发表评论



 


已有 541 条评论 1


  1. Teocycle 回复 2020年2月26日
  2. f1852 tc bolts

    I don’t know whether it’s just me or if everyone else encountering problems with your blog. It looks like some of the written text in your posts are running off the screen. Can someone else please comment and let me know if this is happening to them too? This might be a issue with my web browser because I’ve had this happen before. Thanks

    回复 2020年2月26日
  3. modern technology in construction industry

    Do you have a spam problem on this blog; I also am a blogger, and I was curious about your situation; we have developed some nice practices and we are looking to swap techniques with others, why not shoot me an email if interested.

    回复 2020年2月25日
  4. Kiacycle 回复 2020年2月25日
  5. Kimcycle 回复 2020年2月25日
  6. Jaisalmer escorts service

    You are my breathing in, I possess few web logs and rarely run out from brand :). “Truth springs from argument amongst friends.” by David Hume.

    回复 2020年2月25日
  7. buy weed in uk

    As a Newbie, I am permanently browsing online for articles that can be of assistance to me. Thank you

    回复 2020年2月25日
  8. maid service las vegas

    Good day! I could have sworn I’ve been to this site before but after browsing through some of the post I realized it’s new to me. Nonetheless, I’m definitely delighted I found it and I’ll be bookmarking and checking back often!

    回复 2020年2月25日
  9. home cleaning las vegas

    Interesting blog! Is your theme custom made or did you download it from somewhere? A design like yours with a few simple tweeks would really make my blog jump out. Please let me know where you got your theme. Many thanks

    回复 2020年2月24日
  10. rachel cusk mother

    Hey, I think your website might be having browser compatibility issues. When I look at your blog site in Chrome, it looks fine but when opening in Internet Explorer, it has some overlapping. I just wanted to give you a quick heads up! Other then that, great blog!

    回复 2020年2月24日
  11. Silver spring Braiding salon

    You are my breathing in, I possess few web logs and sometimes run out from to post .

    回复 2020年2月24日
  12. kyrie 5

    A lot of thanks for all of your work on this blog. Kim take interest in going through investigation and it’s easy to understand why. We know all about the lively ways you convey rewarding thoughts by means of this website and in addition attract participation from visitors on that area of interest plus our own girl is certainly starting to learn so much. Have fun with the rest of the year. You’re performing a very good job.

    回复 2020年2月24日
  13. mobil bahis oyna

    Hello, i read your blog occasionally and i own a similar one and i was just wondering if you get a lot of spam comments? If so how do you stop it, any plugin or anything you can recommend? I get so much lately it’s driving me insane so any help is very much appreciated.

    回复 2020年2月23日
  14. betgram

    I’m really enjoying the design and layout of your blog. It’s a very easy on the eyes which makes it much more pleasant for me to come here and visit more often. Did you hire out a developer to create your theme? Exceptional work!

    回复 2020年2月23日
  15. Kimcycle 回复 2020年2月22日
  16. where to buy CBD near me

    Hello! This post could not be written any better! Reading this post reminds me of my old room mate! He always kept chatting about this. I will forward this write-up to him. Fairly certain he will have a good read. Many thanks for sharing!

    回复 2020年2月22日
  17. Silver spring Movers

    I do not even know how I ended up here, but I thought this post was great. I don’t know who you are but definitely you’re going to a famous blogger if you aren’t already 😉 Cheers!

    回复 2020年2月22日
  18. Buy Phone Battery Online

    You could certainly see your expertise within the paintings you write. The arena hopes for more passionate writers like you who aren’t afraid to say how they believe. At all times follow your heart. “What power has law where only money rules.” by Gaius Petronius.

    回复 2020年2月22日
  19. supreme

    I and my guys appeared to be checking out the nice tricks on your website and so the sudden came up with a terrible feeling I had not expressed respect to the blog owner for those secrets. All of the ladies had been very interested to read all of them and have simply been taking pleasure in them. Appreciate your actually being really helpful and then for having varieties of perfect subjects most people are really needing to know about. Our own honest apologies for not expressing gratitude to you earlier.

    回复 2020年2月21日
  20. Bowie Braiding salon

    You could certainly see your enthusiasm in the work you write. The world hopes for more passionate writers like you who aren’t afraid to say how they believe. Always go after your heart.

    回复 2020年2月21日
  21. Virginia Furniture installers

    You are a very smart individual!

    回复 2020年2月21日
  22. DC Furniture assembly

    Greetings! I know this is kinda off topic but I was wondering if you knew where I could get a captcha plugin for my comment form? I’m using the same blog platform as yours and I’m having problems finding one? Thanks a lot!

    回复 2020年2月21日
  23. dotafrog

    You have brought up a very excellent details , thankyou for the post.

    回复 2020年2月20日
  24. moving company sarasota

    wonderful post, very informative. I ponder why the other specialists of this sector do not notice this. You must continue your writing. I am sure, you have a great readers’ base already!

    回复 2020年2月20日
  25. overseas adventure travel catalog

    Hi! I just wanted to ask if you ever have any problems with hackers? My last blog (wordpress) was hacked and I ended up losing a few months of hard work due to no back up. Do you have any methods to stop hackers?

    回复 2020年2月19日
  26. holiday ins with medical conditions

    It’s a pity you don’t have a donate button! I’d most certainly donate to this outstanding blog! I guess for now i’ll settle for bookmarking and adding your RSS feed to my Google account. I look forward to brand new updates and will talk about this site with my Facebook group. Chat soon!

    回复 2020年2月19日
  27. porn

    Howdy very cool web site!! Guy .. Excellent .. Wonderful .. I will bookmark your website and take the feeds additionally…I am satisfied to seek out a lot of useful info right here in the publish, we’d like work out more strategies on this regard, thanks for sharing.

    回复 2020年2月19日
  28. cruise insurance quotes

    Whats up this is kinda of off topic but I was wanting to know if blogs use WYSIWYG editors or if you have to manually code with HTML. I’m starting a blog soon but have no coding experience so I wanted to get guidance from someone with experience. Any help would be enormously appreciated!

    回复 2020年2月19日
  29. digital marketing consulting services

    Hey there, I think your blog might be having browser compatibility issues. When I look at your blog site in Chrome, it looks fine but when opening in Internet Explorer, it has some overlapping. I just wanted to give you a quick heads up! Other then that, great blog!

    回复 2020年2月19日
  30. klook blog

    We absolutely love your blog and find a lot of your post’s to be what precisely I’m looking for. can you offer guest writers to write content for you personally? I wouldn’t mind writing a post or elaborating on many of the subjects you write related to here. Again, awesome site!

    回复 2020年2月19日
  31. top 10 family holiday destinations

    First off I would like to say awesome blog! I had a quick question in which I’d like to ask if you do not mind. I was interested to find out how you center yourself and clear your head before writing. I have had a difficult time clearing my mind in getting my ideas out. I do take pleasure in writing but it just seems like the first 10 to 15 minutes are lost just trying to figure out how to begin. Any ideas or tips? Thanks!

    回复 2020年2月19日
  32. รับจัดงานแต่งงาน ราคาถูก

    hello!,I love your writing so a lot! share we be in contact extra approximately your post on AOL? I need an expert on this house to unravel my problem. Maybe that’s you! Having a look forward to peer you.

    回复 2020年2月19日
  33. trip guide

    Hey! This is kind of off topic but I need some guidance from an established blog. Is it very difficult to set up your own blog? I’m not very techincal but I can figure things out pretty fast. I’m thinking about creating my own but I’m not sure where to begin. Do you have any ideas or suggestions? Many thanks

    回复 2020年2月19日
  34. เช่าโต๊ะหน้าขาว ชลบุรี

    But wanna admit that this is very beneficial , Thanks for taking your time to write this.

    回复 2020年2月19日
  35. birkin bag

    I intended to draft you a very little word in order to say thanks the moment again with your incredible strategies you have documented here. This has been quite incredibly generous of people like you to allow freely all numerous people might have offered for sale as an e-book in order to make some cash for their own end, precisely considering that you might well have tried it if you decided. These ideas likewise acted like a great way to be sure that many people have similar dream much like my own to figure out a good deal more around this problem. I’m sure there are thousands of more fun instances in the future for those who see your website.

    回复 2020年2月19日
  36. cruise cancellation insurance

    Have you ever considered creating an e-book or guest authoring on other sites? I have a blog based upon on the same ideas you discuss and would really like to have you share some stories/information. I know my viewers would value your work. If you are even remotely interested, feel free to shoot me an email.

    回复 2020年2月19日
  37. Kiacycle 回复 2020年2月19日
  38. backpacker blog

    Hello! I’m at work surfing around your blog from my new iphone! Just wanted to say I love reading your blog and look forward to all your posts! Carry on the outstanding work!

    回复 2020年2月18日
  39. top marketing firms

    Please let me know if you’re looking for a writer for your blog. You have some really good articles and I believe I would be a good asset. If you ever want to take some of the load off, I’d really like to write some material for your blog in exchange for a link back to mine. Please shoot me an e-mail if interested. Thank you!

    回复 2020年2月18日
  40. family holiday destinations

    I’m really enjoying the design and layout of your site. It’s a very easy on the eyes which makes it much more enjoyable for me to come here and visit more often. Did you hire out a developer to create your theme? Fantastic work!

    回复 2020年2月18日
  41. asthma travel insurance cover

    Appreciating the time and effort you put into your website and detailed information you provide. It’s awesome to come across a blog every once in a while that isn’t the same out of date rehashed information. Fantastic read! I’ve bookmarked your site and I’m including your RSS feeds to my Google account.

    回复 2020年2月18日
  42. lonely planet kids books

    Hello, I think your website might be having browser compatibility issues. When I look at your website in Firefox, it looks fine but when opening in Internet Explorer, it has some overlapping. I just wanted to give you a quick heads up! Other then that, terrific blog!

    回复 2020年2月18日
  43. เช่าโต๊ะ เก้าอี้

    Good day! Would you mind if I share your blog with my facebook group? There’s a lot of folks that I think would really appreciate your content. Please let me know. Many thanks

    回复 2020年2月18日
  44. สถานที่จัดงานแต่งงานในสวน

    You could certainly see your expertise in the work you write. The world hopes for more passionate writers like you who aren’t afraid to say how they believe. Always follow your heart.

    回复 2020年2月18日
  45. 슬롯 머신

    Does your website have a contact page? I’m having problems locating it but, I’d like to send you an e-mail. I’ve got some suggestions for your blog you might be interested in hearing. Either way, great blog and I look forward to seeing it expand over time.

    回复 2020年2月18日
  46. bahati bukuku

    I beloved up to you’ll receive performed right here. The sketch is attractive, your authored material stylish. nevertheless, you command get bought an nervousness over that you wish be handing over the following. in poor health unquestionably come more until now once more since exactly the same just about a lot steadily inside of case you defend this hike.

    回复 2020年2月18日
  47. Loni Gajardo

    I found your this post while searching for information about blog-related research … It’s a good post .. keep posting and updating information. advice |

    回复 2020年2月18日
  48. Teocycle 回复 2020年2月18日
  49. เกมส์ เป่า ยิ้ ง ฉุ บ

    obviously like your web-site but you need to take a look at the spelling on quite a few of your posts. A number of them are rife with spelling issues and I to find it very bothersome to inform the reality on the other hand I’ll certainly come again again.

    回复 2020年2月18日