drawable-540x960 directory name invalid

前端 未结 5 1960
轻奢々
轻奢々 2021-01-07 01:23

In my application i have to support 540x960 screens. I have created a directory named: drawable-540x960 for containing all graphics items for this screen. But i

5条回答
  •  庸人自扰
    2021-01-07 01:50

    I am sorry to say but s.krueger's solution will not work if you have some other drawable like drawable-mdpi or drawablae-xhdpi or drawable-xxhdpi or drawable-hdpi. It won't take the drawable-hdpi-960x540.

    You have to name the drawable as per your pixel density and the screen size. The calculation is here...

    dpi = sqrt (540^2+960^2) / 4.3"(Device size) = ~256 dp = px / (dpi / 160) = 540 / (dpi / 160) = 330

    The drawable will be named as drawable-sw330dp. I have tested this. And this works good. No problem with other drawables either. Layout Will be layout-sw330dp

    Or you can try this by drawable-sw540p. I haven't tested it yet. But I guess it will work good. Layout Will be layout-sw540p

提交回复
热议问题