Search code examples
androiddrawablenine-patchandroid-screen-support

How to use One Image for support all screen and density devices in Android


Here i develop one android application and i have one image with size 197*253, taht size is used for tablet. but i want to use in small screen device and mobile screen devices. In this case can i use nine-patch image concept.

Please help me,

Thanks in Advance,


Solution

  • Depends on the purpose of your image in your app.

    If it is meant to be stretched (Like buttons and layouts' backgrounds), then NinePatchDrawable is the solution. To convert your .png to a 9-patch, follow these steps.

    If your image is an icon image (like Launcher, Action Bar, Menu and Notification icons), then you should use different .png's for different sizes. You can generate those different sizes manually (by using Photoshop or whatever tool you use to adjust the proper size) or you can use these tools to generate them automatically.