I need a way to detect device screen size and density with adb. If there is no solution, where can I get the complete list of all existing android device with their screen size and density ?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
You can also access the WindowManager through ADB:
The following command will give you the density:
You can also override the density by adding the new density:
shows something like this:
another way:
also shows some interesting stuff like:
and last but not least:
will display something like
that you could easily use to grep for mDisplayWidth and mDisplayHeight
You can get screen dimensions with this code:
Once you have the Display in the code above you can use DisplayMetrics to get the density. DisplayMetrics will also give you absolute display with and height.
Look at the output of adb shell dumpsys. The screen size shows up there several times, along with lots of other information.
... although now I'm in the office, while it works on my phone, it's absent from the Galaxy tablet. Darn.
To get required info from ADB, the following command executed from the command line will return a lot of useful properties about the connected devices
To filter through these properties
on Unix use grep like
on Windows use find like
Returned value looks like
for screen size put display instead of density
Work is Good:
return: Display: init=320x480 cur=320x480 app=320x480 rng=320x295-480x455