In an Android application, I tried using the following method to get the width and height of the screen:
DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); final int screenWidth = metrics.widthPixels; final int screenHeight = metrics.heightPixels;
It reports 1080 and 1920 respectively for my phone, which meets the specifications.
However, inside webview, when I used:
var screenWidth = $(window).width();
Shows only 360.
From this I understand that both use a pixel as a unit, so why are the values ββdifferent?
source share