I have tried different ways to get the screen size of the device, but it always returned me the wrong size (791x480
instead of 854x480
). It might be du
if you want to get the size in the activity, you can make it by the following code.
findViewById(android.R.id.content).getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
View view = findViewById(android.R.id.content);
Log.e("test", "root view height is " + view.getHeight());
}
});