I was wondering if I can change device which decides which layout it should choose or which graphic it should choose/scale. This change should only affect my application of course. Can I set somehow device DPI?
The reason why I'm doing that is this phone: http://www.gsmarena.com/samsung_p1000_galaxy_tab-3370.php it has very bad DPI od 240DPI while it's only 170PPI and should be recognized as 160DPI device. I have quite big graphic for layout-large which looks great on mdpi, but on hdpi they doesn't fit, they are just to big.
Maybe you have another solution than changing device DPI?
To find the DPI, look at the Software Density entry under the Display section. For the Android version, look at the OS version under the Device section. This explicitly displays the version number.
Option 1 – Android 7 (Nougat) and HigherOpen “Settings” > “Display” > “Display size“. Use the slider to choose the setting you like.
Finding Your DPI There are a handful of apps that can show you your DPI value, but the clear-cut best option is DPI Checker by TheViciousGames. It's super lightweight, open source, and does exactly what you need it to do and nothing more.
Yes it is possible. The following will set the dpi to 240. Although you have to refresh the activity somehow e.g. restart application.
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
metrics.density = 1.5f;
metrics.densityDpi = 240;
metrics.heightPixels = 1104;
metrics.widthPixels = 1920;
metrics.scaledDensity = 1.5f;
metrics.xdpi = 254.0f;
metrics.ydpi = 254.0f;
getResources().getDisplayMetrics().setTo(metrics);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With