开发者

Why does 9-patch does not work on wallpapers?

开发者 https://www.devze.com 2023-03-08 10:30 出处:网络
I had a small image 250x208 (size decreased from 960x800) and made 9.png out of it. Set it as a wallpaper image via wallpaperManager.setResource(R.drawable.my_wallpaper); but it is still getting stret

I had a small image 250x208 (size decreased from 960x800) and made 9.png out of it. Set it as a wallpaper image via wallpaperManager.setResource(R.drawable.my_wallpaper); but it is still getting stretched incorrectly like this is not 9-patch image.

Why 9-patch does not size correctly as a wallpaper?

What do you do when you 开发者_运维百科have an app that has to set some image as a wallpaper?

Thanks in advance


I don't believe that WallpaperManager supports nine-patches, so you may need to render the nine-patch yourself using a live wallpaper.


EDIT: removed since the question was changed.

You should just use a View with an android:background set to the nine-patch. There's no need to use an ImageView with all its fancy custom image scaling logic for a background image.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号