I want to use the PNG format of my Android studio drawable logo in splash-screen for APIs 21 and 22. As it has been noted in this post, these APIs have problems with drawables in layer-list
. So I want to convert my drawable file into a PNG format file (using Adobe AI or CorelDraw, etc), but I don't know exactly what dimensions I should save my file to match exactly with Android drawable dp
.
My drawable logo size is 100dp x 100dp
. What dimensions should I export my file to? Is that just one file, or should I export 5 different sizes for idp
, mdp
, xdp
, xxdp
and xxxdp
? I am aware that layer-list
doesn't support @mipmap
resource.
Here is a programmatic way that provides the following unit-conversion formula
pixels = dps * (density / 160)
But do I have to have a PNG file for each density?
Update: I tried to use the above formula or online unit-convertors but the result was so bigger that what I expedted. for my logo that is 100*100 dp*pd
I created a PNG format logo with dimensions 187.5*187.5 px*px
and with dpi 300, that was bigger that 100*100 dp*pd
!