简体   繁体   中英

How to differentiate dimens for two different DPI

I am using Pixel which has 420dpi density and Moto x4 which has a density of 480dpi density. Both use same value folder ie values-xxhdpi.

But, the layout gets large on Moto x4. Is there any way to differentiate different dimens folder?

Mostly you can use

smallest width dp : the smallest width available for application layout in “dp” units; this is the smallest width dp that you will ever encounter in any rotation of the display.

To create one right click on res >>> new >>> Android resource directory

From Available qualifiers window move Smallest Screen Width to Chosen qualifiers

In Screen width window just write the "dp" value starting from you would like Android Studio to use that dimens.

Than change to Project view,right click on your new created resource directory

new >>> Values resource file enter a new file name dimens.xml and you are done.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM