Since Android 7.0 we have multiple window mode. See example in this picture:
User can change the width of window.
How can I get the real width of window?
Since Android 7.0 we have multiple window mode. See example in this picture:
User can change the width of window.
How can I get the real width of window?
Works for me:
Activity yourActivity = ...
DisplayMetrics displayMetrics = new DisplayMetrics();
activity.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
int windowWidth = displayMetrics.widthPixels;