Android gets the height and width of the screen and uses the WindowManager class
There are two methods
1、WindowManager wm = (WindowManager) getContext()
.getSystemService(Context.WINDOW_SERVICE);
int width = wm.getDefaultDisplay().getWidth();
int height = wm.getDefaultDisplay().getHeight();
2、WindowManager wm = this.getWindowManager();
int width = wm.getDefaultDisplay().getWidth();
int height = wm.getDefaultDisplay().getHeight();
Read More:
- Android get screen width and height and get control width and height
- JS Mobile Page to determine whether it is iPhone X, and then set the corresponding height of the element?
- Get the height of mobile phone status bar through reflection
- User defined height of layeui carousel
- Error: Error parsing D:\new_android\Android SDK\system-images\android-25\android-wear\armeabi-v7a\de
- Screen Overlay Detected
- Android error java.lang.IllegalStateException : System services not available to Activities before onC
- Android Studio | Failed to find target with hash string ‘android-26’ in: D:\Android\sdk
- The solution of white screen crash when loading QML
- Syntax Error: SassError: Invalid CSS after “…-height: #{math“: expected expression (e.g. 1px, bold
- Implementation of screen cleaning in Python idle
- GPU hardware acceleration related problems, solve flash screen
- MFC flash screen solution
- Solution of flash screen caused by OpenGL in MFC environment
- How to bypass screen time password with itolab unlockgo for Mac
- Android android.intent.category Purpose and use of. Launcher
- Format control of cout cout.width () and cout.fill ()