How to use 9 patch images in android for different-2 densities(like mdpi,ldpi,hdpi).?

前端 未结 3 1992
情话喂你
情话喂你 2021-02-10 11:04

I am creating an android application in which I want multiple screen support.For these I have used 9 patch images.

But my question is this whether using 9 patch images w

3条回答
  •  梦毁少年i
    2021-02-10 11:55

    Short answer is YES. Check this:

    By default, Android scales your bitmap drawables (.png, .jpg, and .gif files) and Nine-Patch drawables (.9.png files) so that they render at the appropriate physical size on each device. For example, if your application provides bitmap drawables only for the baseline, medium screen density (mdpi), then the system scales them up when on a high-density screen, and scales them down when on a low-density screen. This scaling can cause artifacts in the bitmaps. To ensure your bitmaps look their best, you should include alternative versions at different resolutions for different screen densities.

    from Android Developer Official Doc

提交回复
热议问题