Search code examples
androidxmlbitmapdpi

Scaled dpi bitmaps for various screen sizes' backgrounds


With Android's nine-patch generator (http://romannurik.github.io/AndroidAssetStudio/nine-patches.html), what resolution do you recommend for the base, xhdpi, to retrieve the other scaled dpi bitmaps if I wanted to fit a screen's background on devices ranging from Android wear to Nexus 5 to Android TV?

Are there any alternative ways for this without hardcoding certain dimension-sized png files for particular device screens? Thanks!


Solution

  • The best alternative is to use xml drawable, it fits great on all displays. read more here: http://developer.android.com/guide/topics/resources/drawable-resource.html

    Also, if you plan to make you app for android 5 or later then drawable vector is another great choice: http://developer.android.com/reference/android/graphics/drawable/VectorDrawable.html

    If non of these did the job for you I recommend you to make your resources for hdpi and xxhdpi, these tow should be scaled with no problems most of time.