androidandroid-resourcesandroid-resolutionandroid-resource-qualifiers

Resource qualifier conflict: Same dpi (xxhdpi) but different screen widths in Android


I'm encountering a conflict where two different screen resolutions are using the same dpi setting. This app is strictly in landscape mode.

  1. 2640 x 1080 480dpi (Galaxy Flip 5)
  2. 2115 x 1080 480dpi (Galaxy S23)

Since I'm using the smallest width qualifier in landscape mode, I used the following calculation:

480dpi / 160dpi = 3
1080 / 3 = 360dp

Since 480dpi corresponds to xxhdpi, I created a sw360dp-xxhdpi resource folder and applied dimen values. However, because the Flip 5 has a width of 2640 and the S23 has 2115, although they share the same sw360dp-xxhdpi, there was a significant difference in how views appeared on the screen. How can I more precisely differentiate resources for these two screen resolutions?


Solution

  • I made it by using screen widthqualifier.
    I used 480dpi / 160dpi = 3.

    1. 2640 x 1080 480dpi (Galaxy Flip 5) => the screen width is 880dp(2640 / 3)
    2. 2115 x 1080 480dpi (Galaxy S23) => the screen width is 705dp(2115 / 3) So, the resource will be made of sw360dp-700dp-xxhdpi for Galaxy S23 and sw360-800dp-xxhdpi for Flip 5.