Android Webview - javascript screen dimensions vs actual screen dimensions

后端 未结 1 1770
广开言路
广开言路 2021-01-20 14:49

I have a very simple Activity with the following layout...



        
相关标签:
1条回答
  • 2021-01-20 15:36

    For website you can control the screen size in android using a meta tag in your site.

    There are three settings for the "screen" size low-dpi, medium-dpi and high-dpi.

    So the device is automatically scaling your website (it assumes medium-dpi if you didn't set anything)

    In javascript you don't get the exact pixel size of the device, you get more like the device is somewhere in that area...

    A good explanation for this can be found here: http://developer.android.com/guide/webapps/targeting.html

    0 讨论(0)
提交回复
热议问题