简体   繁体   中英

How to name assets for different screen resolutions?

My app has over 100 images. And how to I specify resources for other resolutions? I see both methods.

One by naming the folders scale-100 and other by naming each file with a suffix of scale 100. My app is developed in C#. And how do I test which image is taken?

For now my folder structure is

Assets -> Images-> scale-100 -> tab_icon_notes_clicked_1366.png

And in the code when I need to reference the image, I reference it like this.

("ms-appx:/Assets/Images/tab_icon_notes_clicked_1366.png");

So without using scale-100 in the image path, it is retrieving an image. I have another folder named as scale-140 in which the higher resolution of the same image is placed. But I cant figure out which image it is taking.. scale-100 or scale-140 ?

You can identify the System Display Scale Information by the Code below

var scaleInfo= DisplayProperties.ResolutionScale;

The system will take care of loading the correct Scale Images from the respective Scale Folders [100,140,180].

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