chrjs
chrjs

Reputation: 2443

Apply correct dimens file for Samsung S8

I try to design a widget and you might know, this is a lot of fun. :) I think I figured it out for most of the devices, but now I have a Samsung Galaxy S8.

I thought it should use the dimens from my xxxhdpi (regarding to the resolution) folder, but it doesn't. It uses sw400dp-xxhdpi. But the dimens for sw400dp-xxhdpi devices does not fit for the S8.

Regarding to the specs it has 360x740dp. So I tried 360x740/dimens.xml and h740dp/dimens.xml none of them are working. It still uses sw400dp.

I might need some other dimens.xml files, is there any easy way to see which device will use which file?

Any ideas?

Upvotes: 2

Views: 426

Answers (1)

Gabe Sechan
Gabe Sechan

Reputation: 93726

Its because your math is wrong. The S8 is 2,960×1,440 at 568 dpi. 1440/568*160=405. So its width is greater than 400. Its grabbing the right file. I'm not sure where you got 360 from.

Edit: Were you using the multiplier for your math(1x,2x,3x, etc)? Don't. The actual DPI values are used most of the time.

Upvotes: 2

Related Questions