简体   繁体   English

适用于各种屏幕尺寸背景的缩放dpi位图

[英]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? 使用Android的9补丁生成器( http://romannurik.github.io/AndroidAssetStudio/nine-patches.html ),如果我想适应一个分辨率为xhdpi的基本分辨率,建议为基础xhdpi检索其他比例的dpi位图从Android Wear到Nexus 5到Android TV的设备的屏幕背景?

Are there any alternative ways for this without hardcoding certain dimension-sized png files for particular device screens? 是否有其他方法可以为特定设备屏幕硬编码某些尺寸大小的png文件? Thanks! 谢谢!

The best alternative is to use xml drawable, it fits great on all displays. 最好的选择是使用xml drawable,它非常适合所有显示。 read more here: http://developer.android.com/guide/topics/resources/drawable-resource.html 在此处阅读更多信息: 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 另外,如果您打算为Android 5或更高版本制作应用,则可绘制矢量是另一个不错的选择: 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. 如果这些都不适合您,我建议您将资源用于hdpi和xxhdpi,则这些丝束在大多数情况下都应毫无问题地进行扩展。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM